pub trait ServerHandler: Send + Sync {
// Required methods
fn initialize<'life0, 'async_trait>(
&'life0 self,
implementation: Implementation,
capabilities: ClientCapabilities,
) -> Pin<Box<dyn Future<Output = Result<ServerCapabilities, Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn shutdown<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn handle_method<'life0, 'life1, 'async_trait>(
&'life0 self,
method: &'life1 str,
params: Option<Value>,
) -> Pin<Box<dyn Future<Output = Result<Value, Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}
Expand description
Trait for implementing MCP server handlers
Required Methods§
Sourcefn initialize<'life0, 'async_trait>(
&'life0 self,
implementation: Implementation,
capabilities: ClientCapabilities,
) -> Pin<Box<dyn Future<Output = Result<ServerCapabilities, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn initialize<'life0, 'async_trait>(
&'life0 self,
implementation: Implementation,
capabilities: ClientCapabilities,
) -> Pin<Box<dyn Future<Output = Result<ServerCapabilities, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Handle initialization