UNPKG

@toolprint/hypertool-mcp

Version:

HyperTool MCP proxy server for routing requests between clients and multiple underlying MCP servers

147 lines • 4.54 kB
/** * Custom error classes */ /** * Base error class for all application errors */ export declare abstract class MetaMCPError extends Error { readonly code: string; readonly category: string; readonly isRetryable: boolean; readonly timestamp: Date; readonly context?: Record<string, any>; constructor(message: string, code: string, category: string, isRetryable?: boolean, context?: Record<string, any>); /** * Get error details as object */ toJSON(): Record<string, any>; /** * Get user-friendly error message */ getUserMessage(): string; } /** * Configuration-related errors */ export declare class ConfigurationError extends MetaMCPError { constructor(message: string, context?: Record<string, any>); getUserMessage(): string; } /** * Connection-related errors */ export declare class ConnectionError extends MetaMCPError { readonly serverName?: string; constructor(message: string, serverName?: string, isRetryable?: boolean, context?: Record<string, any>); getUserMessage(): string; } /** * Server unavailable errors */ export declare class ServerUnavailableError extends MetaMCPError { readonly serverName: string; constructor(serverName: string, reason?: string, context?: Record<string, any>); getUserMessage(): string; } /** * Tool-related errors */ export declare class ToolError extends MetaMCPError { readonly toolName: string; readonly serverName?: string; constructor(message: string, toolName: string, serverName?: string, context?: Record<string, any>); getUserMessage(): string; } /** * Tool not found errors */ export declare class ToolNotFoundError extends MetaMCPError { readonly toolName: string; constructor(toolName: string, context?: Record<string, any>); getUserMessage(): string; } /** * Validation errors */ export declare class ValidationError extends MetaMCPError { readonly field?: string; readonly value?: any; constructor(message: string, field?: string, value?: any, context?: Record<string, any>); getUserMessage(): string; } /** * Request routing errors */ export declare class RoutingError extends MetaMCPError { readonly toolName?: string; readonly serverName?: string; constructor(message: string, toolName?: string, serverName?: string, context?: Record<string, any>); getUserMessage(): string; } /** * Health check errors */ export declare class HealthCheckError extends MetaMCPError { readonly serverName: string; constructor(message: string, serverName: string, context?: Record<string, any>); getUserMessage(): string; } /** * Timeout errors */ export declare class TimeoutError extends MetaMCPError { readonly operation: string; readonly timeoutMs: number; constructor(operation: string, timeoutMs: number, context?: Record<string, any>); getUserMessage(): string; } /** * Discovery errors */ export declare class DiscoveryError extends MetaMCPError { readonly serverName?: string; constructor(message: string, serverName?: string, context?: Record<string, any>); getUserMessage(): string; } /** * Error codes for easy reference */ export declare const ERROR_CODES: { readonly CONFIG_ERROR: "CONFIG_ERROR"; readonly CONNECTION_ERROR: "CONNECTION_ERROR"; readonly SERVER_UNAVAILABLE: "SERVER_UNAVAILABLE"; readonly TOOL_ERROR: "TOOL_ERROR"; readonly TOOL_NOT_FOUND: "TOOL_NOT_FOUND"; readonly VALIDATION_ERROR: "VALIDATION_ERROR"; readonly ROUTING_ERROR: "ROUTING_ERROR"; readonly HEALTH_CHECK_ERROR: "HEALTH_CHECK_ERROR"; readonly TIMEOUT_ERROR: "TIMEOUT_ERROR"; readonly DISCOVERY_ERROR: "DISCOVERY_ERROR"; }; /** * Error categories for filtering and handling */ export declare const ERROR_CATEGORIES: { readonly CONFIGURATION: "configuration"; readonly CONNECTION: "connection"; readonly AVAILABILITY: "availability"; readonly TOOL: "tool"; readonly VALIDATION: "validation"; readonly ROUTING: "routing"; readonly HEALTH: "health"; readonly TIMEOUT: "timeout"; readonly DISCOVERY: "discovery"; }; /** * Utility function to check if error is retryable */ export declare function isRetryableError(error: Error): boolean; /** * Utility function to extract error code */ export declare function getErrorCode(error: Error): string; /** * Utility function to get user-friendly message */ export declare function getUserFriendlyMessage(error: Error): string; //# sourceMappingURL=index.d.ts.map