Types
Core Pydantic models and enums for the protocol shapes.
arcade_mcp_server.types
CallToolResult
Bases: Result
A list of content objects that represent the unstructured result of the call.
content (instance-attribute)
An optional JSON object that represents the structured result of the call.
SessionMessage
Type: dataclass
Wrapper for messages in transport sessions.
Examples
Constructing a JSON-RPC request and response model
Python
from arcade_mcp_server.types import JSONRPCRequest, JSONRPCResponse
req = JSONRPCRequest(id=1, method="ping", params={})
res = JSONRPCResponse(id=req.id, result={})
print(req.model_dump_json())
print(res.model_dump_json())Building a tools/call request and examining result shape
Python
from arcade_mcp_server.types import CallToolRequest, CallToolResult, TextContent
call = CallToolRequest(
id=2,
method="tools/call",
params={
"name": "Toolkit.tool",
"arguments": {"text": "hello"},
},
)
# Result would typically be produced by the server:
result = CallToolResult(
content=[TextContent(type="text", text="Echo: hello")],
structuredContent={"result": "Echo: hello"},
isError=False
)Error Adapters
Error adapters translate vendor-specific exceptions into Arcade errors automatically.
arcade_tdk.error_adapters
ErrorAdapter
Type: Protocol
Base interface for error adapters.
Python
class ErrorAdapter(Protocol):
slug: str
def from_exception(self, error: Exception) -> MCPError | None: ...Built-in Adapters
| Adapter | Handles |
|---|---|
SlackErrorAdapter | Slack SDK errors |
GoogleErrorAdapter | Google API Client errors |
MicrosoftGraphErrorAdapter | Microsoft Graph SDK errors |
HTTPErrorAdapter | fetch/HTTP library errors |
GraphQLErrorAdapter | GraphQL client errors |
Using Error Adapters
Pass adapters to @app.tool to automatically translate exceptions:
Python
from arcade_mcp_server import MCPApp
from arcade_tdk.error_adapters import SlackErrorAdapter
from typing import Annotated
app = MCPApp(name="slack_bot")
@app.tool(adapters=[SlackErrorAdapter()])
def send_message(
channel: Annotated[str, "Slack channel ID"],
text: Annotated[str, "Message text"]
) -> str:
"""Send a message to Slack."""
# SlackApiError → UpstreamError automatically
slack_client.chat_postMessage(channel=channel, text=text)
return "Sent!"Adapters are tried in order. First match wins. HTTPErrorAdapter is always added as fallback.
Last updated on