Hola, good morning,
first of all, congrats on the work. Really useful add on!
I’ve been using it succesfully for a few months, but now Claude has lost connection. It says possibly due to some update from the MCP. I’ll paste Claude’s message here.
Subject: All tools fail validation on MCP clients that validate outputSchema (draft-07 vs 2020-12)
Hi,
I’m using the Anki MCP Server through Claude (Cowork / desktop app, tools proxied
to a remote session). The server connects fine and the full tool list is exposed
to the model, but every tool call fails before it ever reaches AnkiConnect,
with this client-side error:
Error: Tool ‘listDecks’ has an invalid outputSchema: JSON Schema declares an
unsupported dialect (“$schema”: “http://json-schema.org/draft-07/schema#”).
The default validator supports JSON Schema 2020-12 only; pass a pre-configured
Ajv instance to Ajv…
I get the identical error on listDecks, collection_stats, modelNames and getTags,
so it looks like it affects every tool that declares an outputSchema, not one
specific handler.
What seems to be happening: the tools’ outputSchema objects carry
“$schema”: “http://json-schema.org/draft-07/schema#”. The client validates
structured tool output with Ajv in its 2020-12-only configuration, so it rejects
the schema at registration/call time and the request is never dispatched. Nothing
is wrong with AnkiConnect or the local Anki install — the failure is purely in
schema validation on the client side, and there’s no setting I can change from
my end to work around it.
This looks like the classic zod-to-json-schema default: it emits draft-07 unless
told otherwise. Two possible fixes on your side:
- Simply omit the “$schema” key from the generated outputSchema objects. Most
clients then validate with their own default dialect and it works. This is
usually a one-line change (e.g. delete schema.$schema after generation). - Emit 2020-12 explicitly — with zod-to-json-schema use
target: "jsonSchema2020-12", or with Zod 4’s built-in
z.toJSONSchema(schema, { target: "draft-2020-12" })— and make sure no
draft-07-only keywords survive the conversion.
Option 1 is probably the safest for broad client compatibility, since the MCP
spec doesn’t pin a dialect and different hosts validate differently.
Happy to test a patched build and report back if that helps.
Thanks for the work on this server.
Thank’s a lot