Trait McpServerBase

Source
pub trait McpServerBase: Send + Sync {
    // Required methods
    fn get_capabilities<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<ServerCapabilities>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn handle_tool_request<'life0, 'async_trait>(
        &'life0 self,
        request: McpToolRequest,
    ) -> Pin<Box<dyn Future<Output = Result<McpToolResponse>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_stats<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<ServerStats>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn initialize<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn shutdown<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Base MCP server trait

Required Methods§

Source

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

Get server capabilities

Source

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

Handle tool execution request

Source

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

Get server statistics

Source

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

Initialize server

Source

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

Shutdown server

Implementors§