pub struct HttpCodeExecutor { /* private fields */ }Expand description
Low-level HTTP executor bridging the toolkit’s outbound
HttpAuthProvider to pmcp-code-mode’s
HttpExecutor trait.
This is the OpenAPI analog of SqlCodeExecutor, but at a DIFFERENT layer:
it impls the LOW-LEVEL pmcp_code_mode::HttpExecutor
(execute_request(method, path, body)), NOT the high-level
CodeExecutor. It is wrapped by a
JsCodeExecutor for the Code Mode path
(the JsCodeExecutor<HttpCodeExecutor>: CodeExecutor blanket impl) and is
called directly by script tools (Plan 05). The single-call synthesizer
(Plan 03) does NOT use this path — it calls HttpConnector::execute
directly.
§Per-request passthrough token (H1)
The inbound_token field carries the per-request MCP client token captured
by the binary (Plan 06) into [AuthContext]. It is passed to
HttpAuthProvider::apply so an
OAuthPassthroughAuth provider
forwards it to the backend; static providers ignore it (proven in Plan 01).
Because Code Mode reuses ONE executor instance across requests, the binary
produces a per-request clone carrying the captured token via
HttpCodeExecutor::with_inbound_token.
§Redaction (Pitfall 5 / T-90-04-01)
Auth/transport failures are mapped to
ExecutionError::RuntimeError
whose message names the operation / status only — it NEVER echoes the
request URL or the Authorization token.
§Feature gate (H2)
Gated under openapi-code-mode (the Plan 90-01 umbrella that forwards
pmcp-code-mode/js-runtime). The bare code-mode feature does NOT bring
HttpExecutor into scope, so this type cannot be gated on
all(feature = "http", feature = "code-mode").
Implementations§
Source§impl HttpCodeExecutor
impl HttpCodeExecutor
Sourcepub fn new(
client: Client,
base_url: String,
auth: Arc<dyn HttpAuthProvider>,
) -> Self
pub fn new( client: Client, base_url: String, auth: Arc<dyn HttpAuthProvider>, ) -> Self
Construct an executor over client + base_url, authenticating outgoing
requests via auth. The per-request inbound_token starts None;
the binary attaches it per request with
HttpCodeExecutor::with_inbound_token.
Sourcepub fn with_inbound_token(self, token: Option<String>) -> Self
pub fn with_inbound_token(self, token: Option<String>) -> Self
Cheap clone-with-token builder (H1): the binary calls this PER REQUEST to
attach the captured inbound MCP token so an oauth_passthrough provider
forwards it. Static providers ignore the token, so calling this on a
static-auth executor is harmless.
Single-call tools (Plan 03) don’t use this path; the per-request token flows through Code Mode + script tools only.
Trait Implementations§
Source§impl Clone for HttpCodeExecutor
impl Clone for HttpCodeExecutor
Source§fn clone(&self) -> HttpCodeExecutor
fn clone(&self) -> HttpCodeExecutor
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl HttpExecutor for HttpCodeExecutor
impl HttpExecutor for HttpCodeExecutor
Source§fn execute_request<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
method: &'life1 str,
path: &'life2 str,
body: Option<Value>,
) -> Pin<Box<dyn Future<Output = Result<Value, ExecutionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn execute_request<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
method: &'life1 str,
path: &'life2 str,
body: Option<Value>,
) -> Pin<Box<dyn Future<Output = Result<Value, ExecutionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Auto Trait Implementations§
impl Freeze for HttpCodeExecutor
impl !RefUnwindSafe for HttpCodeExecutor
impl Send for HttpCodeExecutor
impl Sync for HttpCodeExecutor
impl Unpin for HttpCodeExecutor
impl UnsafeUnpin for HttpCodeExecutor
impl !UnwindSafe for HttpCodeExecutor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more