Skip to main content

Transport

Trait Transport 

Source
pub trait Transport: Send + Sync {
    // Required methods
    fn send_request<'life0, 'async_trait>(
        &'life0 self,
        request: JsonRpcRequest,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn send_response<'life0, 'async_trait>(
        &'life0 self,
        response: JsonRpcResponse,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn send_notification<'life0, 'async_trait>(
        &'life0 self,
        notification: JsonRpcNotification,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn receive<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Option<McpMessage>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn close<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Transport trait for MCP communication

Required Methods§

Source

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

Send a JSON-RPC request

Source

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

Send a JSON-RPC response

Source

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

Send a JSON-RPC notification

Source

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

Receive incoming messages

Source

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

Close the transport

Implementors§