MCP inputSchema: Moving Tool Schemas to JSON Schema 2020-12

Dec 2, 2026 · 9 min read

Why MCP clients reject draft-07 tool schemas, which keywords changed in JSON Schema 2020-12, and how to emit a 2020-12 inputSchema from Zod or Pydantic.

You build a small MCP server for the IT team: one tool, find_laptop, that takes a serial number and returns the matching record from the asset register. It works in the first client you try. In the next one the tool is missing from the list, or the client logs a schema error and moves on. The tool code is fine. The problem is the JSON Schema you advertised in inputSchema, and which version of JSON Schema it was written in.

This article covers what the MCP spec now says about schema versions, the draft-07 habits that break under JSON Schema 2020-12, how to check your own tools the way a strict client does, and how to emit 2020-12 from Zod, Pydantic or plain JSON.

What changed: SEP-1613 made 2020-12 the default

For the first year of MCP the spec did not say which JSON Schema dialect a tool schema used. SDKs picked their own. Some emitted draft-07, some 2020-12, and clients validated with whatever their validator library defaulted to. SEP-1613 settled it, and the rule is part of the 2025-11-25 version of the MCP tools specification:

  • A schema with no $schema field is read as JSON Schema 2020-12.
  • A schema may name another dialect in $schema, but clients and servers only must support 2020-12. For any other dialect they must either support it or answer with an error saying it is not supported.
  • Servers must generate 2020-12 by default. inputSchema must be a valid schema object, never null.
  • A tool with no parameters should use { "type": "object", "additionalProperties": false }.

So a draft-07 schema can fail in two different ways. If it says "$schema": "http://json-schema.org/draft-07/schema#", a client that only knows 2020-12 is allowed to refuse it. If it says nothing but uses draft-07 keywords, the client reads it as 2020-12, and some of those keywords either break the schema or stop doing anything.

Seeing it fail the way a strict client does

You do not need a real client to reproduce this. Compile each tool's schema with a 2020-12 validator in strict mode. This script uses Ajv's 2020-12 build and three tools from the asset register server:

js
import Ajv2020 from 'ajv/dist/2020.js';

// What a strict 2020-12 client does with each tool it receives from tools/list.
function checkTools(tools) {
  for (const tool of tools) {
    const ajv = new Ajv2020({ strict: true });
    try {
      ajv.compile(tool.inputSchema);
      console.log(`ok    ${tool.name}`);
    } catch (err) {
      console.log(`FAIL  ${tool.name}: ${err.message}`);
    }
  }
}

checkTools([
  {
    name: 'find_laptop',
    inputSchema: {
      $schema: 'http://json-schema.org/draft-07/schema#',
      type: 'object',
      properties: { serial: { type: 'string', minLength: 6 } },
      required: ['serial'],
    },
  },
  {
    name: 'set_display',
    inputSchema: {
      type: 'object',
      properties: {
        resolution: { type: 'array', items: [{ type: 'integer' }, { type: 'integer' }] },
      },
    },
  },
  {
    name: 'list_assets',
    inputSchema: { type: 'object', additionalProperties: false },
  },
]);
text
FAIL  find_laptop: no schema with key or ref "http://json-schema.org/draft-07/schema#"
FAIL  set_display: schema is invalid: data/properties/resolution/items must be object,boolean
ok    list_assets

The first failure is the explicit dialect: the validator has no draft-07 meta-schema loaded, so it cannot even start. The second is a draft-07 tuple. In draft-07, items could be an array of schemas, one per position. In 2020-12 items must be a single schema, so the whole tool definition is invalid.

Run this against the output of your own tools/list before a user finds the problem for you.

The draft-07 keywords that change meaning

The 2020-12 release notes list every change, and some of them arrived one version earlier in 2019-09. For tool schemas, four matter:

  • Tuples. Draft-07 items: [A, B] plus additionalItems: false becomes prefixItems: [A, B] plus items: false.
  • Dependencies. dependencies was split into dependentRequired (a list of property names) and dependentSchemas (a schema).
  • Definitions. definitions became $defs. A $ref to #/definitions/Site still resolves as a plain JSON pointer, but use $defs so every tool reads the same way.
  • Explicit $schema. Either point it at https://json-schema.org/draft/2020-12/schema or leave it out, since 2020-12 is the default in MCP.

The dependencies case is the nasty one, because nothing errors. A 2020-12 validator treats it as an unknown keyword and skips it, so a rule you thought was enforced quietly stops being checked. Here is a draft-07 schema for a register_laptop tool:

json
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "properties": {
    "serial": { "type": "string", "minLength": 6 },
    "resolution": {
      "type": "array",
      "items": [{ "type": "integer" }, { "type": "integer" }],
      "additionalItems": false
    },
    "warrantyStart": { "type": "string" },
    "warrantyEnd": { "type": "string" },
    "location": { "$ref": "#/definitions/Site" }
  },
  "required": ["serial"],
  "dependencies": { "warrantyEnd": ["warrantyStart"] },
  "definitions": {
    "Site": {
      "type": "object",
      "properties": { "building": { "type": "string" }, "floor": { "type": "integer" } }
    }
  }
}

Validated as draft-07 it does what you expect: a three-item resolution is rejected and warrantyEnd without warrantyStart is rejected. Read as 2020-12, the tuple makes the schema invalid, and once you fix only the tuple, the warranty rule is ignored. Here is the same tool written for 2020-12:

json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "serial": { "type": "string", "minLength": 6 },
    "resolution": {
      "type": "array",
      "prefixItems": [{ "type": "integer" }, { "type": "integer" }],
      "minItems": 2,
      "items": false
    },
    "warrantyStart": { "type": "string" },
    "warrantyEnd": { "type": "string" },
    "location": { "$ref": "#/$defs/Site" }
  },
  "required": ["serial"],
  "dependentRequired": { "warrantyEnd": ["warrantyStart"] },
  "$defs": {
    "Site": {
      "type": "object",
      "properties": { "building": { "type": "string" }, "floor": { "type": "integer" } }
    }
  }
}

I checked it with Python's jsonschema package, the meta-schema check first and then three sets of tool arguments:

python
import json
from jsonschema import Draft202012Validator

schema = json.load(open("migrated.json"))
Draft202012Validator.check_schema(schema)  # raises if the schema itself is not valid 2020-12
v = Draft202012Validator(schema)

calls = [
    {"serial": "5CG4182QWX", "resolution": [1920, 1200]},
    {"serial": "5CG4182QWX", "resolution": [1920, 1200, 60]},
    {"serial": "5CG4182QWX", "warrantyEnd": "2029-03-31"},
]
for args in calls:
    errors = [e.message for e in v.iter_errors(args)]
    print(errors or "valid")
text
valid
['Expected at most 2 items but found 1 extra: 60']
["'warrantyStart' is a dependency of 'warrantyEnd'"]

The minItems: 2 line is there because Ajv in strict mode refuses a prefixItems tuple without it, and because a resolution with one number is a bug anyway.

Where draft-07 sneaks in: your schema generator

Almost nobody writes tool schemas by hand. They come from a library, and the library decides the dialect. Two things I found while testing for this article are worth knowing.

First, the old zod-to-json-schema package targets draft-07, and when I passed it a Zod 4 object (version 3.25.2 of the package, Zod 4.6.7) it returned {"$schema": "http://json-schema.org/draft-07/schema#"} and nothing else: an empty schema that accepts any arguments at all. Zod 4 has its own converter, z.toJSONSchema(), which targets 2020-12 by default and takes target: "draft-07" only if you ask for it.

Second, version 1.32.2 of the official TypeScript SDK, which I tested, lists a tool registered through McpServer.registerTool() with a Zod shape as "$schema": "http://json-schema.org/draft-07/schema#". The SDK's own conversion code falls back to draft-7 when no target is given. That is legal under the spec, since the dialect is declared, but it is exactly the case a 2020-12-only client may refuse. Check what your SDK version emits rather than assuming.

If you want full control, register the tools with the low-level Server class and build the schema yourself. One Zod object validates the arguments and produces the advertised 2020-12 schema, so the two cannot drift apart:

js
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
import { ListToolsRequestSchema, CallToolRequestSchema } from '@modelcontextprotocol/sdk/types.js';
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
import { InMemoryTransport } from '@modelcontextprotocol/sdk/inMemory.js';
import { z } from 'zod';

// One Zod schema is the source of truth for both validation and the advertised JSON Schema.
const FindLaptopArgs = z.object({
  serial: z.string().min(6).describe('Service tag or serial number, e.g. 5CG4182QWX'),
  includeWarranty: z.boolean().optional(),
});

const server = new Server({ name: 'asset-register', version: '1.0.0' }, { capabilities: { tools: {} } });

server.setRequestHandler(ListToolsRequestSchema, async () => ({
  tools: [{
    name: 'find_laptop',
    description: 'Look up a laptop in the IT asset register by serial number',
    inputSchema: z.toJSONSchema(FindLaptopArgs), // Zod 4 targets draft 2020-12 by default
  }],
}));

server.setRequestHandler(CallToolRequestSchema, async (req) => {
  const args = FindLaptopArgs.safeParse(req.params.arguments);
  if (!args.success) {
    return { isError: true, content: [{ type: 'text', text: z.prettifyError(args.error) }] };
  }
  return { content: [{ type: 'text', text: `HP EliteBook 840 G11, serial ${args.data.serial}` }] };
});

// Connect a client in the same process and look at what it receives.
const [serverSide, clientSide] = InMemoryTransport.createLinkedPair();
await server.connect(serverSide);
const client = new Client({ name: 'inspector', version: '1.0.0' });
await client.connect(clientSide);

const { tools } = await client.listTools();
console.log(tools[0].inputSchema.$schema);
const bad = await client.callTool({ name: 'find_laptop', arguments: { serial: '5CG' } });
console.log(bad.content[0].text);
await client.close();
text
https://json-schema.org/draft/2020-12/schema
✖ Too small: expected string to have >=6 characters
  → at serial

Note that a bad argument comes back as a tool result with isError: true, not as a protocol error. The model can read that message and retry with a full serial number.

Python servers: Pydantic already speaks 2020-12

If your server is in Python, Pydantic's JSON Schema output follows 2020-12 and leaves out $schema, which MCP now reads as 2020-12. Nested models land under $defs:

python
import json
from typing import Optional
from pydantic import BaseModel, Field

class FindLaptop(BaseModel):
    serial: str = Field(min_length=6, description="Service tag or serial number")
    include_warranty: Optional[bool] = None

print(json.dumps(FindLaptop.model_json_schema(), indent=2))
json
{
  "properties": {
    "serial": {
      "description": "Service tag or serial number",
      "minLength": 6,
      "title": "Serial",
      "type": "string"
    },
    "include_warranty": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Include Warranty"
    }
  },
  "required": [
    "serial"
  ],
  "title": "FindLaptop",
  "type": "object"
}

Starting from an example call

Sometimes you have the arguments before you have a schema: a sample call from a log, or the body an existing REST endpoint takes. Paste that object into the JSON Schema generator to get a first draft. It writes a draft-07 $schema line, but the keywords it produces (type, properties, required, and items as a single schema) mean the same thing in 2020-12. Change that line to the 2020-12 URL, or delete it, then add the limits you know about, such as minLength on the serial.

When a client reports a schema error, grab the raw tools/list response from its logs and run it through the JSON validator first. A stray trailing comma in a hand-edited schema file produces the same "tool not available" symptom, and the validator points at the exact line. For a quick look at a long tool list, the online JSON parser lays the response out as a table, which is easier to scan than a wall of raw JSON.

A checklist before you ship a server

  • Leave $schema out of inputSchema and outputSchema, or set it to https://json-schema.org/draft/2020-12/schema.
  • Search your schemas for "items": [, additionalItems, dependencies and definitions, and migrate them.
  • Compile every schema from tools/list with a strict 2020-12 validator in CI, as in the script above.
  • Give tools without parameters { "type": "object", "additionalProperties": false }, never null.
  • Check the dialect your SDK or converter really emits. Do not trust a default you have not printed.

None of this is hard once you know where to look. The reason it bites is that the failure shows up in someone else's client, as a tool that silently is not there.

← All JSON articles Browse all categories →