UNPKG

maplestorysea-mcp-server

Version:

NEXON MapleStory SEA API MCP Server for Claude Desktop - Complete character info, union details, guild data, rankings optimized for SEA servers

156 lines 6.26 kB
/** * Custom error classes for MCP Maple * Provides structured error handling for different failure scenarios */ export declare class McpMapleError extends Error { readonly code: string; readonly statusCode?: number | undefined; readonly context?: Record<string, any> | undefined; constructor(message: string, code: string, statusCode?: number | undefined, context?: Record<string, any> | undefined); toJSON(): Record<string, any>; } export declare class NexonApiError extends McpMapleError { constructor(message: string, statusCode: number, endpoint?: string, params?: Record<string, any>); } export declare class CharacterNotFoundError extends McpMapleError { constructor(characterName: string); } export declare class GuildNotFoundError extends McpMapleError { constructor(guildName: string, worldName?: string); } export declare class InvalidApiKeyError extends McpMapleError { constructor(); } export declare class RateLimitError extends McpMapleError { constructor(retryAfter?: number); } export declare class ValidationError extends McpMapleError { constructor(field: string, value: any, expectedType?: string); } export declare class NetworkError extends McpMapleError { constructor(originalError: Error); } export declare class TimeoutError extends McpMapleError { constructor(timeout: number, endpoint?: string); } export declare class RankingTimeoutError extends McpMapleError { constructor(timeout: number, endpoint: string, queryParams?: Record<string, any>); } export declare class CacheError extends McpMapleError { constructor(operation: string, originalError?: Error); } export declare class ConfigurationError extends McpMapleError { constructor(setting: string, value?: any); } export declare class ServiceUnavailableError extends McpMapleError { constructor(service: string, reason?: string); } /** * SEA API specific errors */ export declare class SeaApiUnsupportedFeatureError extends McpMapleError { constructor(feature: string); } export declare class SeaWorldNotFoundError extends McpMapleError { constructor(worldName: string); } export declare class SeaCharacterNameError extends McpMapleError { constructor(characterName: string, reason?: string); } export declare class SeaGuildNameError extends McpMapleError { constructor(guildName: string, reason?: string); } export declare class SeaMaintenanceError extends McpMapleError { constructor(estimatedEndTime?: string); } export declare class SeaDataUnavailableError extends McpMapleError { constructor(dataType: string, characterName?: string, additionalInfo?: string); } export declare class SeaQuotaExceededError extends McpMapleError { constructor(quotaType: 'daily' | 'hourly' | 'concurrent', resetTime?: string); } export declare class SeaValidationError extends McpMapleError { constructor(field: string, value: any, requirement: string, suggestion?: string); } export declare class SeaConnectionError extends McpMapleError { constructor(type: 'timeout' | 'network' | 'gateway', duration?: number, endpoint?: string); } export declare class DatabaseError extends McpMapleError { constructor(operation: string, originalError?: Error); } export declare class AuthenticationError extends McpMapleError { constructor(reason?: string); } export declare class AuthorizationError extends McpMapleError { constructor(resource: string, action: string); } export declare class ToolExecutionError extends McpMapleError { constructor(toolName: string, originalError: Error); } export declare function createNexonApiError(statusCode: number, message: string, endpoint?: string, params?: Record<string, any>): McpMapleError; /** * SEA API specific error factory */ export declare function createSeaApiError(type: 'unsupported_feature' | 'invalid_world' | 'invalid_character_name', details: { feature?: string; worldName?: string; characterName?: string; reason?: string; }): McpMapleError; export declare function isRetryableError(error: Error): boolean; export declare function getRetryDelay(attemptNumber: number, baseDelay?: number, errorType?: 'rate_limit' | 'server_error' | 'network_error' | 'timeout'): number; export declare function shouldRetryError(error: Error, attemptNumber: number): boolean; export declare function getRetryDelayForError(error: Error, attemptNumber: number): number; export declare function sanitizeErrorForLogging(error: any): Record<string, any>; /** * Enhanced error logging for SEA API debugging */ export declare function createDetailedErrorLog(error: Error, context?: { operation?: string; endpoint?: string; params?: Record<string, any>; attemptNumber?: number; duration?: number; userAgent?: string; timestamp?: Date; }): Record<string, any>; /** * Format error for user display (customer-friendly message) */ export declare function formatErrorForUser(error: Error): string; export interface ErrorRecoveryStrategy { name: string; canHandle: (error: Error) => boolean; recover: (error: Error, context?: any) => Promise<any>; maxAttempts?: number; } export declare class ErrorRecoveryManager { private strategies; registerStrategy(strategy: ErrorRecoveryStrategy): void; attemptRecovery(error: Error, context?: any): Promise<any>; } export declare const retryStrategy: ErrorRecoveryStrategy; export declare const fallbackStrategy: ErrorRecoveryStrategy; export declare const cacheBypassStrategy: ErrorRecoveryStrategy; export declare const seaApiUnsupportedFeatureStrategy: ErrorRecoveryStrategy; export declare const seaWorldValidationStrategy: ErrorRecoveryStrategy; export declare const defaultErrorRecovery: ErrorRecoveryManager; export declare class ErrorAggregator { private errors; addError(operation: string, error: Error, context?: any): void; hasErrors(): boolean; getErrors(): { operation: string; error: Error; context?: any; }[]; getErrorCount(): number; getSummary(): { total: number; byType: Record<string, number>; byCode: Record<string, number>; }; clear(): void; createAggregateError(): McpMapleError; } //# sourceMappingURL=errors.d.ts.map