Skip to main content

ToolSource

Trait ToolSource 

Source
pub trait ToolSource: Send + Sync {
    // Required methods
    fn id(&self) -> &str;
    fn kind(&self) -> SourceKind;
    fn list<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<ToolSpec>, ToolError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn call<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        tool: &'life1 str,
        ctx: &'life2 ToolContext,
        args: Value,
    ) -> Pin<Box<dyn Future<Output = Result<ToolOutput, ToolError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;

    // Provided method
    fn target(&self, _tool: &str, _args: &Value) -> CallTarget { ... }
}
Expand description

A set of tools behind one connection (in-process, an MCP server, a remote node).

Required Methods§

Source

fn id(&self) -> &str

Source

fn kind(&self) -> SourceKind

Source

fn list<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<ToolSpec>, ToolError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn call<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, tool: &'life1 str, ctx: &'life2 ToolContext, args: Value, ) -> Pin<Box<dyn Future<Output = Result<ToolOutput, ToolError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Provided Methods§

Source

fn target(&self, _tool: &str, _args: &Value) -> CallTarget

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§