/**
 * @fileoverview MCP-compliant error handling utilities
 *
 * This module provides standardized error handling for Model Context Protocol (MCP)
 * servers, including error types, formatting, and response generation that comply
 * with MCP specifications.
 */
import { ApiResponse } from '../../models/common.js';
/**
 * Standard MCP error codes based on JSON-RPC 2.0 specification
 * These codes are exported for use by consumers of the library
 */
export declare enum MCPErrorCode {
    PARSE_ERROR = -32700,
    INVALID_REQUEST = -32600,
    METHOD_NOT_FOUND = -32601,
    INVALID_PARAMS = -32602,
    INTERNAL_ERROR = -32603,
    SERVER_ERROR = -32000,
    RESOURCE_NOT_FOUND = -32001,
    AUTHENTICATION_ERROR = -32002,
    AUTHORIZATION_ERROR = -32003,
    RATE_LIMITED = -32004,
    TIMEOUT_ERROR = -32005,
    VALIDATION_ERROR = -32006,
    DEPENDENCY_ERROR = -32007,
    CONFIGURATION_ERROR = -32008,
    NETWORK_ERROR = -32009,
    CLIENT_ERROR = -32010
}
/**
 * MCP error categories for better error classification
 * These categories are exported for use by consumers of the library
 */
export declare enum MCPErrorCategory {
    CLIENT_ERROR = "client_error",
    SERVER_ERROR = "server_error",
    NETWORK_ERROR = "network_error",
    VALIDATION_ERROR = "validation_error",
    AUTHENTICATION_ERROR = "authentication_error",
    RESOURCE_ERROR = "resource_error",
    INTERNAL_ERROR = "internal_error",
    TRANSPORT_ERROR = "transport_error"
}
/**
 * Interface for structured MCP error information
 */
export interface MCPErrorInfo {
    code: MCPErrorCode | string;
    message: string;
    category: MCPErrorCategory | string;
    details?: Record<string, unknown>;
    cause?: Error;
    retryable?: boolean;
    userFriendly?: boolean;
}
/**
 * Enhanced error class for MCP-compliant errors
 */
export declare class MCPError extends Error {
    readonly name = "MCPError";
    readonly code: MCPErrorCode | string;
    readonly category: MCPErrorCategory | string;
    readonly details?: Record<string, unknown>;
    readonly cause?: Error;
    readonly retryable: boolean;
    readonly userFriendly: boolean;
    readonly timestamp: Date;
    constructor(info: MCPErrorInfo);
    /**
     * Converts the error to a JSON-serializable object
     */
    toJSON(): Record<string, unknown>;
}
export { MCPErrorFactory } from './mcp-error-factory.js';
export { MCPErrorConverter } from './mcp-error-converter.js';
export { MCPErrorFormatter } from './mcp-error-formatter.js';
/**
 * Type guard to check if an error is an MCPError
 */
export declare function isMCPError(error: unknown): error is MCPError;
/**
 * Validates that a value is not null or undefined
 */
export declare function validateRequired<T>(value: T | null | undefined, fieldName: string): T;
/**
 * Validates that a string is not empty
 */
export declare function validateNonEmptyString(value: unknown, fieldName: string): string;
/**
 * Validates that a number is within a specified range
 */
export declare function validateNumberRange(value: number, fieldName: string, min?: number, max?: number): number;
/**
 * Higher-order function to wrap handlers with MCP-compliant error handling
 */
export declare function withMCPErrorHandling<TParams, TResult>(handler: (_params: TParams) => Promise<TResult>, context?: string): (params: TParams) => Promise<TResult | ApiResponse>;
