/** * Error mapping — Adobe SDK / unknown errors → structured MCP tool results. * * MCP convention: tool errors are returned as a CallToolResult with isError=true * and an explanatory text content block. They are NOT thrown as protocol errors * unless the failure is at the protocol layer itself (bad request, etc.). */ import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js"; export interface ToolErrorPayload { code: string; message: string; details?: Record; } export declare function toolError(payload: ToolErrorPayload): CallToolResult; /** Strip credential-shaped fields from a headers-shaped object. */ declare function sanitizeHeaders(input: unknown): Record | undefined; /** * Truncate a body value to MAX_BODY_BYTES. Strings are sliced; objects are * JSON-stringified then sliced. The output is a string in both cases so the * downstream caller doesn't have to discriminate. */ declare function truncateBody(body: unknown): string | undefined; interface SanitizedResponse { status?: number; statusText?: string; body?: string; request?: { method?: string; url?: string; headers?: Record; }; } /** * Forward only an allowlisted subset of an SDK error's `.response`. Anything * outside the allowlist — particularly request headers — is dropped to avoid * leaking the Authorization bearer token or x-api-key into MCP output. */ declare function sanitizeSdkResponse(input: unknown): SanitizedResponse | undefined; /** Wrap unknown errors thrown by SDK calls into structured tool errors. */ export declare function mapSdkError(err: unknown): ToolErrorPayload; /** Exported for tests. Do not use directly from tool code. */ export declare const __testing__: { sanitizeSdkResponse: typeof sanitizeSdkResponse; sanitizeHeaders: typeof sanitizeHeaders; truncateBody: typeof truncateBody; REDACTED_HEADER_NAMES: Set; MAX_BODY_BYTES: number; }; export {}; //# sourceMappingURL=errors.d.ts.map