Expand description
MCP method dispatch using command pattern.
This module implements a command pattern for MCP method dispatch, replacing string matching with type-safe enum variants.
§Architecture
McpMethod (enum)
├── Initialize
├── ListTools
├── CallTool
├── ListResources
├── ReadResource
├── ListPrompts
├── GetPrompt
├── Ping
└── Unknown(String)§Open/Closed Principle
To add a new method:
- Add a variant to
McpMethod - Update [
McpMethod::from_str] parsing - Add handler in [
McpServer::dispatch_method]
The dispatch logic is centralized and type-safe.
Enums§
- McpMethod
- MCP method identifier.