import type { McpErrorCodeTypes, McpServerType } from '../types.js';
export type McpErrorData = {
    readonly code: McpErrorCodeTypes;
    readonly message: string;
    readonly data?: unknown;
    readonly requestId?: string | number | null;
};
export declare class McpError extends Error {
    readonly code: McpErrorCodeTypes;
    readonly data?: unknown;
    readonly requestId?: string | number | null;
    constructor(code: McpErrorCodeTypes, message: string, data?: unknown, requestId?: string | number | null);
    /**
     * Creates a JSON-RPC 2.0 compliant error response
     */
    createErrorResponse(): Response;
}
/**
 * Creates a method not allowed error response
 */
export declare function createMethodNotAllowedError(requestId?: string | number | null): Response;
/**
 * Creates an internal server error response with telemetry
 */
export declare function createInternalServerError(error: Error | string, serverType?: McpServerType, requestId?: string | number | null): Response;
/**
 * Creates an invalid request error response
 */
export declare function createInvalidRequestError(message?: string, requestId?: string | number | null): Response;
/**
 * Creates an invalid parameters error response
 */
export declare function createInvalidParamsError(message?: string, requestId?: string | number | null): Response;
/**
 * Safely handles errors in async functions with proper cleanup
 */
export declare function withErrorHandling<T>(operation: () => Promise<T>, serverType: McpServerType, cleanup?: () => Promise<void>): Promise<T | Response>;
//# sourceMappingURL=errors.d.ts.map