Skip to main content

McpClient

Trait McpClient 

Source
pub trait McpClient: Send + Sync {
    // Required methods
    fn initialize<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<InitializeResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn list_tools<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<ListToolsResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn call_tool<'life0, 'life1, 'async_trait>(
        &'life0 self,
        tool_name: &'life1 str,
        arguments: Value,
    ) -> Pin<Box<dyn Future<Output = Result<CallToolResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn server_name(&self) -> &str;
    fn status(&self) -> ServerStatus;
}
Expand description

MCP client trait for communicating with an MCP server.

Required Methods§

Source

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

Initialize the connection to the MCP server.

Source

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

List available tools from the server.

Source

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

Call a tool on the server.

Source

fn server_name(&self) -> &str

Get the server name.

Source

fn status(&self) -> ServerStatus

Get the current server status.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§