/** * MCP-specific error classes */ import { AgentError } from '../errors.js'; /** * Error codes for MCP operations */ export declare enum MCPErrorCode { /** MCP SDK is not installed */ SDK_NOT_INSTALLED = "SDK_NOT_INSTALLED", /** Failed to connect to MCP server */ CONNECTION_FAILED = "CONNECTION_FAILED", /** Server not found in manager */ SERVER_NOT_FOUND = "SERVER_NOT_FOUND", /** Tool not found on server */ TOOL_NOT_FOUND = "TOOL_NOT_FOUND", /** Tool execution failed */ TOOL_EXECUTION_FAILED = "TOOL_EXECUTION_FAILED", /** Transport error (stdio/http) */ TRANSPORT_ERROR = "TRANSPORT_ERROR", /** Connection or operation timeout */ TIMEOUT = "TIMEOUT", /** Invalid server configuration */ INVALID_CONFIG = "INVALID_CONFIG", /** Server already exists */ SERVER_EXISTS = "SERVER_EXISTS" } /** * Error thrown for MCP-related failures * * @example * ```typescript * throw new MCPError( * 'Failed to connect to server', * 'filesystem', * MCPErrorCode.CONNECTION_FAILED * ); * ``` */ export declare class MCPError extends AgentError { readonly serverName: string; readonly code: MCPErrorCode; constructor(message: string, serverName: string, code: MCPErrorCode, cause?: Error); /** * Check if the error is due to missing SDK */ isSDKNotInstalled(): boolean; /** * Check if the error is retryable (connection/timeout issues) */ isRetryable(): boolean; } /** * Type guard to check if an error is an MCPError */ export declare function isMCPError(error: unknown): error is MCPError; /** * Create an SDK not installed error with helpful message */ export declare function createSDKNotInstalledError(): MCPError;