import type { Tool } from "@modelcontextprotocol/server"; import { UnusableSchemaError } from "../json-schema/unusable-schema.js"; /** An action's input schema cannot be advertised as written. */ export declare class McpToolSchemaError extends UnusableSchemaError { readonly tool: string; constructor(tool: string, path: string, reason: string); } /** * The input schema an MCP host forwards verbatim to its model provider, where * one rejected tool fails every request in the session. Each step only widens * what the schema accepts, because the action still validates every call * against its own schema and a host that checks arguments against this copy * must not refuse a call the action would take: * * - The schema is read once, into a plain copy that every later step reads * (`plainJsonSnapshot`), so what is checked is what is advertised. * - Every reference is checked against the source and made a plain pointer * before anything is rewritten; one that does not resolve throws instead of * vanishing with the branch that held it. References that point inside a * composition move into root `$defs`. * - `stripUnsupportedSchemaKeywords` removes the keywords providers reject, * and moves an enum that lists anything but strings into the description. * A position with no type, including the bounded stand-in the action layer * already wrote, references one recursive "any JSON value" definition. * - A root anyOf/oneOf/allOf is flattened; Anthropic rejects one. An empty * `anyOf` or `oneOf` accepts no value, which no flattened object can say, * so one anywhere throws, and so does a root no object satisfies. * - Boolean subschemas, and the missing `items` of an array, become that * definition too: Codex lowers both to `{ "type": "string" }`, which would * narrow the contract. * - `maxItems` moves into the description. Gemini refuses a forced call once * the bound times the item schema is large enough, with no published limit * to stay under: 1,000 strings failed, and so did 100 of Content's property * entries (OpenRouter, 2026-10-17). * - A string `const` becomes a one-value `enum`, which means the same thing, * and replaces an `enum` beside it, since only the value both allow is * accepted. A `const` its `enum` does not list accepts nothing and throws, * and so does an empty `enum`, which would otherwise go out with no type. * Gemini's schema has `enum` but no `const`, and a forced call answered * `const: "text"` with "STRING". Number and boolean values stay `const`: * Gemini's OpenAPI `enum` takes strings only. * * A schema in another dialect gets only the copy and the strip. */ export declare function mcpToolInputSchema(name: string, schema: unknown): Tool["inputSchema"];