/** * Maps upstream `MeertrackApiError`s into MCP tool-call results per spec * §server/tools (isError semantics): upstream REST failures are **tool * execution errors**, not protocol errors — the LLM needs to read them and * self-correct. They go back as `{ content: [{ type: "text", text }], isError: true }`. * * Malformed MCP requests (unknown tool, invalid params) are handled by the * SDK as JSON-RPC protocol errors (-32601 / -32602) — those never hit this * module. * * Never attach `structuredContent` on `isError: true`: when a tool declares * an `outputSchema`, the spec requires `structuredContent` to conform, and * error envelopes (e.g. `{ rate_limit_reset }`) don't conform to e.g. * `ActivityListResponse`. */ import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js"; /** * Narrowed `CallToolResult` for the error branch. `isError: true` per spec, * text-only `content`, and no `structuredContent` (the outputSchema doesn't * cover error shapes). */ export type ToolErrorResult = CallToolResult & { isError: true; }; /** Map any error thrown inside a tool handler to an MCP tool-error result. */ export declare function toToolError(err: unknown): ToolErrorResult; //# sourceMappingURL=errors.d.ts.map