Skip to main content

McpHandler

Trait McpHandler 

Source
pub trait McpHandler: Send + Sync {
    // Required methods
    fn handle<'life0, 'life1, 'async_trait>(
        &'life0 self,
        request: &'life1 McpRequest,
    ) -> Pin<Box<dyn Future<Output = Result<McpResponse>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn handle_notification<'life0, 'life1, 'async_trait>(
        &'life0 self,
        notification: &'life1 McpNotification,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

MCP 消息处理器 trait

Required Methods§

Source

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

处理请求

Source

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

处理通知

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§