export type McpErrorCode = 'SOURCE_UNAVAILABLE' | 'INVALID_PARAMS' | 'RATE_LIMITED' | 'AUTH_FAILED' | 'INTERNAL_ERROR'; export interface McpTextContent { [key: string]: unknown; type: 'text'; text: string; } export interface ToolResult { [key: string]: unknown; content: McpTextContent[]; isError?: boolean; } export interface McpErrorResult { [key: string]: unknown; content: [{ [key: string]: unknown; type: 'text'; text: string; }]; isError: true; } export declare function makeMcpError(error: string, code: McpErrorCode, details?: string): McpErrorResult; export interface ToolCallContext { serverName: string; toolName: string; } /** Execute a tool handler, catching and formatting any thrown errors. */ export declare function withMcpMiddleware(_ctx: ToolCallContext, handler: () => Promise): Promise; //# sourceMappingURL=middleware.d.ts.map