Skip to main content

McpBridge

Trait McpBridge 

Source
pub trait McpBridge: Send + Sync {
    // Required methods
    fn set_mcp_client<'life0, 'async_trait>(
        &'life0 self,
        client: Arc<McpClient>,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn clear_mcp_client<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn mcp_client(&self) -> Option<Arc<McpClient>>;
    fn list_mcp_tools<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<McpToolInfo>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn has_mcp_tool<'life0, 'life1, 'async_trait>(
        &'life0 self,
        tool_name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn execute_mcp_tool<'life0, 'life1, 'async_trait>(
        &'life0 self,
        tool_name: &'life1 str,
        args: Value,
    ) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn refresh_mcp_tools<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Model Context Protocol (MCP) tool bridge.

Provides access to external tools exposed via MCP servers. Handles client lifecycle, tool discovery, and execution delegation.

Required Methods§

Source

fn set_mcp_client<'life0, 'async_trait>( &'life0 self, client: Arc<McpClient>, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Set or replace the MCP client.

Source

fn clear_mcp_client<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Clear the current MCP client and all cached tool indexes.

Source

fn mcp_client(&self) -> Option<Arc<McpClient>>

Get the current MCP client, if any.

Source

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

List all tools available via MCP.

Source

fn has_mcp_tool<'life0, 'life1, 'async_trait>( &'life0 self, tool_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Check if a tool name corresponds to an MCP-provided tool.

Source

fn execute_mcp_tool<'life0, 'life1, 'async_trait>( &'life0 self, tool_name: &'life1 str, args: Value, ) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Execute a tool via the MCP client.

Source

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

Refresh MCP tool registrations from all connected servers.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§