Skip to main content

ToolProvider

Trait ToolProvider 

Source
pub trait ToolProvider: Send + Sync {
    // Required method
    fn call<'a>(
        &'a self,
        tool: &'a str,
        args_json: &'a str,
    ) -> Pin<Box<dyn Future<Output = Result<McpResponse, ToolCallError>> + Send + 'a>>;
}
Expand description

The embedder-provided answerer for @tools calls. The value is a bounded JSON tree (McpResponse::take admits it), so guest conversion stays bounded whoever produced it.

Object-safe boxed-future trait (rather than async fn), like McpTransport, so a harness may answer in process or forward the call over the wire.

Required Methods§

Source

fn call<'a>( &'a self, tool: &'a str, args_json: &'a str, ) -> Pin<Box<dyn Future<Output = Result<McpResponse, ToolCallError>> + Send + 'a>>

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§