Skip to main content

ClientTransport

Trait ClientTransport 

Source
pub trait ClientTransport: Send {
    // Required methods
    fn request<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        method: &'life1 str,
        params: Value,
    ) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn notify<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        method: &'life1 str,
        params: Value,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn is_connected(&self) -> bool;
    fn close<'async_trait>(
        self: Box<Self>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait;
}
Expand description

Trait for MCP client transports

Required Methods§

Source

fn request<'life0, 'life1, 'async_trait>( &'life0 mut self, method: &'life1 str, params: Value, ) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Send a request and receive a response

Source

fn notify<'life0, 'life1, 'async_trait>( &'life0 mut self, method: &'life1 str, params: Value, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Send a notification (no response expected)

Source

fn is_connected(&self) -> bool

Check if the transport is still connected

Source

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

Close the transport

Implementors§