pub struct McpBridgeTool { /* private fields */ }Expand description
A ToolExecutor bridging one tool on one configured MCP server.
Why: the registry dispatches by name and knows nothing about MCP; this is
the adapter that keeps it that way.
What: name is the composed mcp__<server>__<tool> key the registry and
the advertised schema both use; remote is the bare name the server itself
answers to. The client is shared (Arc<Mutex<_>>) because one stdio pair
carries one in-flight request at a time, and because every tool on a server
must keep THAT server’s child alive — dropping the last handle kills it.
Test: super::tests::tool_tests::execute_surfaces_a_broken_server_recoverably,
mcp_loader_e2e::end_to_end_dispatch_echoes_through_the_registry.
Implementations§
Source§impl McpBridgeTool
impl McpBridgeTool
Sourcepub fn new(
server: &str,
tool: &McpTool,
client: Arc<Mutex<StdioMcpClient>>,
) -> Result<Self, String>
pub fn new( server: &str, tool: &McpTool, client: Arc<Mutex<StdioMcpClient>>, ) -> Result<Self, String>
Build one bridge tool, or say why the tool cannot be exposed.
What: Err carries the reason build_schema refused, for the caller
to record as an issue.
Test: super::tests::tool_tests::an_oversized_input_schema_is_rejected.
Trait Implementations§
Source§impl ToolExecutor for McpBridgeTool
impl ToolExecutor for McpBridgeTool
Source§fn execute<'life0, 'async_trait>(
&'life0 self,
args: Value,
) -> Pin<Box<dyn Future<Output = ToolResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn execute<'life0, 'async_trait>(
&'life0 self,
args: Value,
) -> Pin<Box<dyn Future<Output = ToolResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Forward the call to the server, recoverably.
Why: an MCP server can die, hang or reject at any point in a run, and
none of those may end the agent loop — the model has to be able to read
the failure and choose something else.
What: a transport failure and an in-band isError both become
ToolResult::err naming the server and the tool, so the model can tell
“this connector is broken” from “my arguments were wrong”.
Test: super::tests::tool_tests::execute_surfaces_a_broken_server_recoverably,
mcp_loader_e2e::end_to_end_dispatch_echoes_through_the_registry.
Source§fn schema(&self) -> Value
fn schema(&self) -> Value
Source§fn restricted_tiers(&self) -> &[ServiceTier]
fn restricted_tiers(&self) -> &[ServiceTier]
Auto Trait Implementations§
impl !RefUnwindSafe for McpBridgeTool
impl !UnwindSafe for McpBridgeTool
impl Freeze for McpBridgeTool
impl Send for McpBridgeTool
impl Sync for McpBridgeTool
impl Unpin for McpBridgeTool
impl UnsafeUnpin for McpBridgeTool
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> 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