pub trait McpTransport: Send + Sync {
// Required methods
fn list_tools<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<ToolDefinition>, McpTransportError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn call_tool<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
args: Value,
) -> Pin<Box<dyn Future<Output = Result<Value, McpTransportError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn shutdown<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), McpTransportError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn is_alive(&self) -> bool;
fn transport_type(&self) -> TransportTypeId;
}Expand description
Abstract transport interface for MCP server communication.
All MCP transports (stdio, HTTP, SSE) implement this trait to provide a uniform interface for tool discovery, execution, and shutdown.
Required Methods§
Sourcefn list_tools<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<ToolDefinition>, McpTransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_tools<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<ToolDefinition>, McpTransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get the list of available tools from the server.
Sourcefn call_tool<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
args: Value,
) -> Pin<Box<dyn Future<Output = Result<Value, McpTransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn call_tool<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
args: Value,
) -> Pin<Box<dyn Future<Output = Result<Value, McpTransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Execute a tool with the given arguments.
Sourcefn shutdown<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), McpTransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn shutdown<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), McpTransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Perform a clean shutdown of the transport.
Sourcefn transport_type(&self) -> TransportTypeId
fn transport_type(&self) -> TransportTypeId
Get the transport type identifier.
Implementors§
impl McpTransport for HttpTransportAdapter
Available on crate feature
http only.impl McpTransport for StdioTransportAdapter
Available on crate feature
stdio only.