Trait McpTransportConn
pub trait McpTransportConn: Send + Sync {
// Required methods
fn send_and_recv<'life0, 'life1, 'async_trait>(
&'life0 mut self,
request: &'life1 JsonRpcRequest,
) -> Pin<Box<dyn Future<Output = Result<JsonRpcResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn close<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn reset<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn health_check(&mut self) -> bool { ... }
}Expand description
Abstract transport for MCP communication.
Required Methods§
Sourcefn send_and_recv<'life0, 'life1, 'async_trait>(
&'life0 mut self,
request: &'life1 JsonRpcRequest,
) -> Pin<Box<dyn Future<Output = Result<JsonRpcResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn send_and_recv<'life0, 'life1, 'async_trait>(
&'life0 mut self,
request: &'life1 JsonRpcRequest,
) -> Pin<Box<dyn Future<Output = Result<JsonRpcResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Send a JSON-RPC request and receive the response.
Provided Methods§
Sourcefn reset<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn reset<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Reset per-connection session state so the next operation re-establishes a fresh session. Default is a no-op for stateless transports (stdio).
Sourcefn health_check(&mut self) -> bool
fn health_check(&mut self) -> bool
Check whether the underlying transport is still alive without sending a
real request. The HTTP and SSE transports always return Ok(true) —
connection drops surface through send_and_recv errors. The stdio
transport verifies the child process is still running via try_wait().