| title | Errors - Arcade MCP Python Reference |
|---|---|
| description | Domain-specific error types raised by the MCP server and components |
import { Callout } from "nextra/components";
Domain-specific error types raised by the MCP server and components.
MCP Exception Hierarchy
Provides domain-specific exceptions for better error handling and debugging.
Bases: Exception
Base error for all MCP-related exceptions.
Bases: MCPError
Runtime error for all MCP-related exceptions.
Bases: MCPError
Error in context management.
Bases: MCPRuntimeError
Error in server operations.
Bases: MCPContextError
Authorization failure.
Bases: ServerError
Error in lifespan management.
Bases: MCPContextError
Requested entity not found.
Bases: MCPContextError
Error in prompt management.
Bases: MCPRuntimeError
Error in MCP protocol handling.
Bases: ServerError
Error in request processing from client to server.
Bases: MCPContextError
Error in resource management.
Bases: ServerError
Error in request processing from server to client.
Bases: RequestError
Error in sending request from server to client initiated by the server.
Bases: ServerError
Error in session management.
Bases: MCPRuntimeError
Error in transport layer (stdio, HTTP, etc).
Tool execution errors with retry semantics. Re-exported via arcade_mcp_server.exceptions.
Bases: ToolExecutionError
The operation failed but can be retried.
from arcade_mcp_server.exceptions import RetryableToolError
# Simple retry
raise RetryableToolError("Service temporarily unavailable")
# With retry delay
raise RetryableToolError(
"Rate limited",
retry_after_ms=5000
)
# With guidance for the AI
raise RetryableToolError(
"Search returned no results",
additional_prompt_content="Try broader search terms or check spelling."
)Bases: ToolExecutionError
Unrecoverable error — the AI should not retry.
from arcade_mcp_server.exceptions import FatalToolError
raise FatalToolError("Account has been permanently deleted")
# With developer-only details
raise FatalToolError(
"Configuration error",
developer_message="Missing required API key in environment"
)Bases: ToolExecutionError
The operation needs additional context from the user before it can proceed.
from arcade_mcp_server.exceptions import ContextRequiredToolError
raise ContextRequiredToolError(
"Multiple users found matching 'John'",
additional_prompt_content="Please specify: John Smith (john@work.com) or John Doe (john@home.com)"
)Bases: ToolExecutionError
Error from an external API or service.
from arcade_mcp_server.exceptions import UpstreamError
raise UpstreamError(
"Slack API error: channel_not_found",
status_code=404
)Bases: UpstreamError
Rate limit from an external API. Includes retry information.
from arcade_mcp_server.exceptions import UpstreamRateLimitError
raise UpstreamRateLimitError(
"Rate limited by Slack",
retry_after_ms=60_000
)MCPError (base)
├── MCPContextError (user/input caused the error)
│ ├── AuthorizationError
│ ├── NotFoundError
│ ├── PromptError
│ └── ResourceError
└── MCPRuntimeError (server/infrastructure caused the error)
├── ProtocolError
├── TransportError
└── ServerError
├── RequestError
│ └── ServerRequestError
├── ResponseError
├── SessionError
└── LifespanError
ToolkitError (base for tool errors)
└── ToolError
└── ToolRuntimeError
└── ToolExecutionError
├── RetryableToolError (can retry)
├── FatalToolError (do not retry)
├── ContextRequiredToolError (needs user input)
└── UpstreamError (external API failure)
└── UpstreamRateLimitError
from arcade_mcp_server.exceptions import (
NotFoundError,
RetryableToolError,
FatalToolError,
)
# Resource not found
async def read_resource_or_fail(uri: str) -> str:
if not await exists(uri):
raise NotFoundError(f"Resource not found: {uri}")
return await read(uri)
# Retryable failure
async def fetch_data(url: str):
try:
return await http_client.get(url)
except ConnectionError as e:
raise RetryableToolError(
"Failed to connect. Please try again.",
developer_message=str(e)
)
# Unrecoverable failure
def validate_config(config: dict):
if "api_key" not in config:
raise FatalToolError("Missing required configuration: api_key")