Sign inTry it

JSON Schema

JSON Schema is a vocabulary for describing and validating the structure of JSON data. A schema uses keywords such as type, properties and required to state which fields a document needs and what types they take. A validator checks a JSON document against the schema and reports where it does not match.

Updated

How JSON Schema works

A small schema might say that the input is an object, that it has a city field, and that the field is a string. The schema is itself JSON. A validator reads it and checks each value. Schemas can also set limits such as minimum and maximum values, string lengths and default values.

Why it matters for AI agents

MCP tools declare their inputs as JSON Schema. The model reads that schema to learn the argument names, types and required fields, so it can produce a valid call. Without a schema, the model has to guess the shape of the input.

Wield and JSON Schema

Wield validates recipes against a JSON Schema file in its repository, contracts/recipe.schema.json. Recipe parameters use the same style of keywords. A parameter can have a type, minLength, maxLength, minimum, maximum or default. Tools in wield-mcp take typed parameters for the same reason: the agent sends values in the expected shape.

FAQ

Which JSON Schema draft does MCP use?

The MCP tools specification describes tool inputs in JSON Schema and names the draft it uses. Check the specification for the exact version rather than relying on a summary.

Why do tools need schemas?

A schema tells the model the name, type and required status of each argument. A validator can then reject a call with the wrong shape before the tool runs.

Sources

  1. JSON Schemajson-schema.org
  2. MCP tools specmodelcontextprotocol.io