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§
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn server_name(&self) -> &str
fn server_name(&self) -> &str
Get the server name.
Sourcefn status(&self) -> ServerStatus
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".