/** * Tool arguments are strict: an argument a tool does not declare is refused, * never silently dropped. * * Every tool is registered with its strict schema (`strictInput`), so the * published JSON Schema says `additionalProperties: false` and the MCP SDK * itself refuses an unknown key. The SDK reports its refusal as plain text, * though, and every run402-mcp error carries `structuredContent`. So the * guard below validates a `tools/call` against the same strict schema before * the SDK sees it, and answers a failure itself with the structured error: * `UNKNOWN_ARGUMENT` (with the closest declared names) or `INVALID_ARGUMENTS`. * A valid call passes through untouched. */ import { z } from "zod"; import type { Transport } from "@modelcontextprotocol/sdk/shared/transport.js"; import type { ToolError } from "./structured.js"; /** A tool's input shape as a strict object: unknown keys fail. */ export declare function strictInput(shape: T): z.ZodObject, any> extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never, z.baseObjectInputType extends infer T_2 ? { [k_1 in keyof T_2]: T_2[k_1]; } : never>; type StrictSchema = z.ZodObject; /** The structured refusal for arguments that fail a tool's strict schema, or null when they pass. */ export declare function argumentError(tool: string, schema: StrictSchema, args: unknown): ToolError | null; /** * Refuse invalid tool arguments with a structured result before the server * dispatches the call. Install after `server.connect(transport)`, which sets * the transport's `onmessage`. */ export declare function guardToolArguments(transport: Transport, schemas: Record): void; export {}; //# sourceMappingURL=input-guard.d.ts.map