Build an error response from an error value or message string.
Never exposes raw stack traces to MCP clients.
When no explicit classification is provided, the error is automatically
classified via classifyError so all error responses — whether
routed through handleToolError or built directly by tool handlers —
include consistent errorCode, errorCategory, and retryable metadata.
Build an error response from an error value or message string. Never exposes raw stack traces to MCP clients.
When no explicit classification is provided, the error is automatically classified via classifyError so all error responses — whether routed through
handleToolErroror built directly by tool handlers — include consistenterrorCode,errorCategory, andretryablemetadata.