Skip to main content

McpClient

Trait McpClient 

Source
pub trait McpClient: Send + Sync {
    // Required methods
    fn server_name(&self) -> &str;
    fn list_tools<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<ToolDescriptor>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn call<'life0, 'life1, 'async_trait>(
        &'life0 self,
        call: &'life1 ToolCall,
    ) -> Pin<Box<dyn Future<Output = Result<ToolResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

An MCP client connected to a single server (one trait instance per declared server). Implementations wrap rmcp transports.

Required Methods§

Source

fn server_name(&self) -> &str

Source

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

List the tools the server advertises.

Source

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

Invoke a tool. The orchestrator is responsible for the human-in-the- loop approval; this trait is the raw RPC.

Implementors§