Skip to main content

resq_mcp.core.errors

Structured error handling for ResQ MCP tools. Provides consistent, AI-client-friendly error responses with actionable context. Inspired by Archon MCP server error handling patterns.

annotations

json

Any

MCPErrorFormatter Objects

class MCPErrorFormatter()
Formats errors consistently for MCP AI clients.

MCPErrorFormatter.format_error

@staticmethod
def format_error(error_type: str,
                 message: str,
                 details: dict[str, Any] | None = None,
                 suggestion: str | None = None,
                 http_status: int | None = None) -> str
Format a structured error response as JSON.

MCPErrorFormatter.from_exception

@staticmethod
def from_exception(exception: Exception,
                   operation: str,
                   context: dict[str, Any] | None = None) -> str
Format error from a Python exception.