Skip to main content

ToolProvider

Trait ToolProvider 

Source
pub trait ToolProvider: Send + Sync {
    // Required methods
    fn tools(&self, ctx: &CallContext) -> Vec<Tool>;
    fn call_tool<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        ctx: &'life1 CallContext,
        name: &'life2 str,
        arguments: JsonObject,
    ) -> Pin<Box<dyn Future<Output = Option<CallToolResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

A group of tools served by the MCP route. The host mounts one or more providers, so a host that cannot offer a capability (e.g. screen management without the app database) leaves that provider out.

Required Methods§

Source

fn tools(&self, ctx: &CallContext) -> Vec<Tool>

Tools visible to this caller.

Source

fn call_tool<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, ctx: &'life1 CallContext, name: &'life2 str, arguments: JsonObject, ) -> Pin<Box<dyn Future<Output = Option<CallToolResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Runs name; None when this provider does not own the tool.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§