/** * @name payments/schema-validation * @description Pre-payment schema validation for x402 paid tool calls. * * Validates tool arguments against the local registration store's JSON Schema * BEFORE the x402 challenge is fetched and paid. This prevents wasted USDC * on calls with invalid schemas (e.g. wrong parameter names, missing required * fields). * * If the tool name is not found in the local registration store (hosted-only * tools), validation is skipped — we cannot validate what we don't have the * schema for. This is intentionally non-breaking: existing behavior is * preserved for unknown tools. * * @module payments/schema-validation */ import type { Server } from '@modelcontextprotocol/sdk/server/index.js'; /** * Store the server reference for pre-payment schema validation. * Called once during registerX402PaidCallTool(). * @param server — The MCP server instance with registered tools. */ export declare function setValidationServer(server: Server): void; /** * Validation result for a tool's input arguments. */ export interface SchemaValidationResult { /** True if arguments match the tool's schema. */ valid: boolean; /** Human-readable validation errors (empty if valid). */ errors: string[]; /** True if validation was skipped (tool not found locally). */ skipped: boolean; /** Tool name that was validated. */ toolName: string; } /** * Validate tool arguments against the local registration store's JSON Schema. * * Uses simple runtime type checking against the JSON Schema properties — * checks required fields, enum values, and basic types. This is intentionally * lightweight (no ajv dependency) to keep the bridge fast and dependency-free. * * If the tool is not registered locally, returns `skipped: true` and * `valid: true` — the caller should proceed with the x402 flow as normal. * * @param toolName — Name of the tool to validate against. * @param args — Arguments to validate. * @returns SchemaValidationResult with validity and error details. */ export declare function validateToolArguments(toolName: string, args: unknown): SchemaValidationResult; //# sourceMappingURL=schema-validation.d.ts.map