Classes
MCPHandler
7
▼
Protocol for MCP method handlers.
Implemented by the leaf MCP server (direct CLI calls) and the
ga…
MCPHandler
7
▼
Protocol for MCP method handlers.
Implemented by the leaf MCP server (direct CLI calls) and the gateway (proxy to child processes). The router dispatches to the appropriate method without duplicating the match/case structure.
Methods
initialize
1
dict[str, Any]
▼
initialize
1
dict[str, Any]
▼
def initialize(self, params: dict[str, Any]) -> dict[str, Any]
Parameters
| Name | Type | Description |
|---|---|---|
params |
— |
Returns
dict[str, Any]
list_tools
1
dict[str, Any]
▼
list_tools
1
dict[str, Any]
▼
def list_tools(self, params: dict[str, Any]) -> dict[str, Any]
Parameters
| Name | Type | Description |
|---|---|---|
params |
— |
Returns
dict[str, Any]
call_tool
1
dict[str, Any]
▼
call_tool
1
dict[str, Any]
▼
def call_tool(self, params: dict[str, Any]) -> dict[str, Any]
Parameters
| Name | Type | Description |
|---|---|---|
params |
— |
Returns
dict[str, Any]
list_resources
1
dict[str, Any]
▼
list_resources
1
dict[str, Any]
▼
def list_resources(self, params: dict[str, Any]) -> dict[str, Any]
Parameters
| Name | Type | Description |
|---|---|---|
params |
— |
Returns
dict[str, Any]
read_resource
1
dict[str, Any]
▼
read_resource
1
dict[str, Any]
▼
def read_resource(self, params: dict[str, Any]) -> dict[str, Any]
Parameters
| Name | Type | Description |
|---|---|---|
params |
— |
Returns
dict[str, Any]
list_prompts
1
dict[str, Any]
▼
list_prompts
1
dict[str, Any]
▼
def list_prompts(self, params: dict[str, Any]) -> dict[str, Any]
Parameters
| Name | Type | Description |
|---|---|---|
params |
— |
Returns
dict[str, Any]
get_prompt
1
dict[str, Any]
▼
get_prompt
1
dict[str, Any]
▼
def get_prompt(self, params: dict[str, Any]) -> dict[str, Any]
Parameters
| Name | Type | Description |
|---|---|---|
params |
— |
Returns
dict[str, Any]
Functions
dispatch
3
dict[str, Any] | None
▼
Route an MCP method to the appropriate handler method.
Returns None for notifi…
dispatch
3
dict[str, Any] | None
▼
def dispatch(handler: MCPHandler, method: str, params: dict[str, Any]) -> dict[str, Any] | None
Route an MCP method to the appropriate handler method.
Returns None for notification methods (no response required). Raises ValueError for unknown methods.
Parameters
| Name | Type | Description |
|---|---|---|
handler |
MCPHandler |
|
method |
str |
|
params |
dict[str, Any] |
Returns
dict[str, Any] | None