Skip to main content

ToolProvider

Trait ToolProvider 

Source
pub trait ToolProvider: Send + Sync {
    // Required methods
    fn discover_tools(
        &self,
    ) -> BoxFuture<'_, Result<Vec<Arc<dyn Tool>>, SynwireError>>;
    fn get_tool(
        &self,
        name: &str,
    ) -> BoxFuture<'_, Result<Option<Arc<dyn Tool>>, SynwireError>>;
}
Expand description

Abstracts over sources of tools.

Implementations include:

  • StaticToolProvider — wraps a fixed list.
  • CompositeToolProvider — aggregates multiple providers.
  • McpToolProvider (in synwire-mcp-adapters) — sources tools from MCP servers.

Required Methods§

Source

fn discover_tools( &self, ) -> BoxFuture<'_, Result<Vec<Arc<dyn Tool>>, SynwireError>>

Returns all tools available from this provider.

§Errors

Returns SynwireError if tool discovery fails (e.g. network error).

Source

fn get_tool( &self, name: &str, ) -> BoxFuture<'_, Result<Option<Arc<dyn Tool>>, SynwireError>>

Returns a single tool by exact name, or None if not found.

§Errors

Returns SynwireError if the lookup fails.

Implementors§