mcp-protocol-server 0.2.0

⛔ DEPRECATED: Use mcp-protocol-sdk v0.4.0+ instead. This crate is consolidated into the main SDK.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//! Handler types and traits.

use async_trait::async_trait;
use mcp_protocol_types::*;
use std::future::Future;
use std::pin::Pin;

/// Tool handler function type
pub type ToolHandler = Box<dyn Fn(CallToolRequest) -> Pin<Box<dyn Future<Output = Result<CallToolResult, McpError>> + Send>> + Send + Sync>;

/// Resource handler function type  
pub type ResourceHandler = Box<dyn Fn(ReadResourceRequest) -> Pin<Box<dyn Future<Output = Result<ReadResourceResult, McpError>> + Send>> + Send + Sync>;

/// Prompt handler function type
pub type PromptHandler = Box<dyn Fn(GetPromptRequest) -> Pin<Box<dyn Future<Output = Result<GetPromptResult, McpError>> + Send>> + Send + Sync>;