Skip to main content

request_executor_from_extra

Function request_executor_from_extra 

Source
pub fn request_executor_from_extra(
    base: &HttpCodeExecutor,
    extra: &RequestHandlerExtra,
) -> HttpCodeExecutor
Expand description

Derive a per-request HttpCodeExecutor from a pmcp::RequestHandlerExtra by threading the captured inbound MCP client token (Plan 90-10 / OAPI-03 / OAPI-05).

This is the toolkit-resident replacement for the binary’s dead assemble.rs::request_executor (WR-01 — the binary helper had NO runtime callers because the handlers, which live in THIS crate, could not reach it across the crate boundary). Both crate::tools’s ScriptToolHandler and the OpenAPI [tool_handlers::ExecuteCodeHandler] call this from inside their handle methods so the per-request oauth_passthrough token actually reaches the outbound request at runtime.

Reads extra.auth_context().and_then(|ctx| ctx.token.clone()) (the raw inbound Authorization header captured by the binary’s TokenCaptureAuthProvider) and returns a cheap clone of base carrying that token via HttpCodeExecutor::with_inbound_token. For an oauth_passthrough backend the cloned executor forwards the captured token to target_header; for static-auth backends the token is ignored (harmless).