Skip to main content

dispatch_request

Function dispatch_request 

Source
pub async fn dispatch_request(
    state: &Arc<ServerState>,
    tracker: &Arc<ReadTracker>,
    caps: &mut Arc<CapabilitySet>,
    caller_id: &mut Option<String>,
    req: Request,
) -> Response
Expand description

Run the full Request state machine and produce a Response.

Intended for stream-oriented transports (UDS) where the listener keeps per-connection capability + caller-id state across many requests on the same socket. caps and caller_id are mutated in place when Request is a Hello — UDS connection.rs::handle_connection relies on this.

HTTP listeners should not use dispatch_request for tools/call translation; they should call run_tool directly after building a fresh per-request CapabilitySet from the bearer-resolved BearerIdentity. The Hello / Ping / ToolList / ToolSchema branches are still useful in introspection-only contexts and remain available via the same fn.