/** * MCP Client Foundation — structured error model (2.13.0). * * Every failure crossing the Jensen boundary is a machine-readable * `McpClientError` with a stable `code`, a useful human description, and * retained server/tool identity. Transport/process failures retain diagnostics; * secrets never leak through error serialization. * * SDK mapping (v2): wire/protocol errors are `ProtocolError` (numeric JSON-RPC * codes); local SDK failures are `SdkError` (string `SdkErrorCode`); process * spawn failures are Node `ErrnoException`s. All are normalized to the stable * Jensen vocabulary below — callers never see SDK error classes. */ export type McpErrorCode = "MCP_SERVER_NOT_FOUND" | "MCP_INVALID_SERVER_CONFIG" | "MCP_SPAWN_FAILED" | "MCP_INITIALIZATION_FAILED" | "MCP_INCOMPATIBLE_SERVER" | "MCP_CONNECTION_LOST" | "MCP_REQUEST_TIMEOUT" | "MCP_REQUEST_CANCELLED" | "MCP_TOOL_NOT_FOUND" | "MCP_TOOL_CALL_FAILED" | "MCP_PROTOCOL_ERROR" | "MCP_INVALID_RESULT" | "MCP_SHUTDOWN_FAILED" | "MCP_SESSION_NOT_FOUND" | "MCP_SESSION_INVALID" | "MCP_INVALID_TOOL_CALL"; export interface McpErrorContext { serverId?: string; sessionId?: string; toolName?: string; /** Safe diagnostic detail (e.g., argv identity or stderr tail). Never env secrets. */ detail?: string; cause?: unknown; } /** * Jensen MCP error. The `message` is human-facing; `code`, `serverId`, * `sessionId`, and `toolName` are machine-readable. */ export declare class McpClientError extends Error { readonly code: McpErrorCode; readonly serverId?: string; readonly sessionId?: string; readonly toolName?: string; readonly detail?: string; readonly cause?: unknown; constructor(code: McpErrorCode, message: string, context?: McpErrorContext); /** Secret-safe serialization surface for CLI/evidence consumers. */ toJSON(): Record; } /** * Map an arbitrary SDK/transport/protocol error to a stable Jensen code. * Transport failure, protocol failure, server failure, and tool failure are * kept distinct so callers and the evidence system never conflate them. */ export declare function classifyMcpError(error: unknown, options?: { toolName?: string; }): McpErrorCode; /** * Classify a connect/initialize/negotiation failure specifically. Initialization * has its own vocabulary (incompatible vs failed vs lost) while still respecting * the underlying timeout/spawn distinctions. */ export declare function classifyMcpConnectError(error: unknown): McpErrorCode; //# sourceMappingURL=mcp-error.d.ts.map