Functions
handle_mcp_request
2
Response
▼
Handle an MCP JSON-RPC request.
Takes a chirp Request, returns a chirp Respons…
async
handle_mcp_request
2
Response
▼
async def handle_mcp_request(request: Request, registry: ToolRegistry) -> Response
Handle an MCP JSON-RPC request.
Takes a chirp Request, returns a chirp Response. This function is
called from within the middleware pipeline inhandle_request(),
so all middleware (auth, CORS, rate limiting) applies.
Parameters
| Name | Type | Description |
|---|---|---|
request |
Request |
|
registry |
ToolRegistry |
Returns
Response
_handle_notification
1
Response
▼
Handle a JSON-RPC notification (no response expected).
MCP clients send ``noti…
_handle_notification
1
Response
▼
def _handle_notification(method: str) -> Response
Handle a JSON-RPC notification (no response expected).
MCP clients sendnotifications/initializedafter the initialize
handshake completes. Per JSON-RPC spec, notifications have noid
and the server MUST NOT reply. We return 204 No Content.
Parameters
| Name | Type | Description |
|---|---|---|
method |
str |
Returns
Response
_dispatch
3
Any
▼
Route a JSON-RPC method to the appropriate handler.
async
_dispatch
3
Any
▼
async def _dispatch(method: str, params: dict[str, Any], *, registry: ToolRegistry) -> Any
Parameters
| Name | Type | Description |
|---|---|---|
method |
str |
|
params |
dict[str, Any] |
|
registry |
ToolRegistry |
Returns
Any
_handle_initialize
1
dict[str, Any]
▼
Handle MCP ``initialize`` — capability negotiation.
_handle_initialize
1
dict[str, Any]
▼
def _handle_initialize(params: dict[str, Any]) -> dict[str, Any]
Parameters
| Name | Type | Description |
|---|---|---|
params |
dict[str, Any] |
Returns
dict[str, Any]
_handle_tools_list
1
dict[str, Any]
▼
Handle MCP ``tools/list`` — return registered tool schemas.
_handle_tools_list
1
dict[str, Any]
▼
def _handle_tools_list(registry: ToolRegistry) -> dict[str, Any]
Parameters
| Name | Type | Description |
|---|---|---|
registry |
ToolRegistry |
Returns
dict[str, Any]
_handle_tools_call
2
dict[str, Any]
▼
Handle MCP ``tools/call`` — dispatch to tool handler.
async
_handle_tools_call
2
dict[str, Any]
▼
async def _handle_tools_call(params: dict[str, Any], registry: ToolRegistry) -> dict[str, Any]
Parameters
| Name | Type | Description |
|---|---|---|
params |
dict[str, Any] |
|
registry |
ToolRegistry |
Returns
dict[str, Any]
_format_result
1
dict[str, Any]
▼
Format a tool result as an MCP content block.
_format_result
1
dict[str, Any]
▼
def _format_result(result: Any) -> dict[str, Any]
Parameters
| Name | Type | Description |
|---|---|---|
result |
Any |
Returns
dict[str, Any]
_json_response
2
Response
▼
Build a chirp Response with JSON content.
_json_response
2
Response
▼
def _json_response(status: int, body: dict[str, Any]) -> Response
Parameters
| Name | Type | Description |
|---|---|---|
status |
int |
|
body |
dict[str, Any] |
Returns
Response