mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-09 13:01:00 +00:00
The SDK renders every tool's Zod shape with a fixed draft-07 target and stamps "$schema": "http://json-schema.org/draft-07/schema#" on each inputSchema and outputSchema. Clients that validate with a 2020-12-only validator refuse that dialect when the tool list arrives, so every tool was unusable there (#1170). Wrap the tools/list handler once, after the last tool is registered, and re-render each advertised schema from the same Zod shape with the draft-2020-12 target, without a $schema key. A schema with no $schema is 2020-12 under the MCP spec and still compiles in a draft-07 client. All other fields of a tool entry pass through unchanged, and the SDK keeps validating structuredContent against the Zod shape, so tool results are unaffected. For the current surface the 54 rendered schemas differ from the previous ones only by the dropped key. The new guard reads tools/list through a real client for a write-scoped session, rejects any draft-07 marker or construct, and compiles every schema with Ajv's 2020-12 build (ajv added as a dev dependency at the version the SDK already resolves).