Skip to main content
Glama

Jig

Validate JSON against a JSON Schema (every error with its path)

jig_validate_json
Read-onlyIdempotent

Use when the user asks whether some JSON matches a JSON Schema, or when JSON from a model reply, structured output, tool call, API response or file has to be checked against its schema before it is used or stored (signals: "validate this JSON", "does this match the schema", "which field is wrong", "the model returned bad JSON", "check the tool-call arguments", "why does my parser reject this"). Validates a JSON value (data), or raw model text (json_text: a ```json fence or prose around one JSON value is stripped; a syntax error comes back with line and column), against JSON Schema draft 2020-12, 2019-09, 07, 06 or 04, including $ref/$defs, anyOf/oneOf/allOf, if/then/else, unevaluatedProperties, patterns and formats (email, date-time, date, time, uuid, uri, hostname, ipv4, ipv6, duration). Returns valid true/false, every problem with its JSON Pointer path, keyword, expected and got values, and retry_message: a ready-to-send list of fixes for the model that produced the JSON. Example: {"schema":{"type":"object","properties":{"price":{"type":"number"}},"required":["price","sku"]},"data":{"price":"12.50"}}. Gives the expected answer on 6,018 of 6,227 official JSON-Schema-Test-Suite cases (ajv 8: 5,981); most misses are external $ref URLs, which are not fetched, $dynamicRef, and the idn-email, idn-hostname and iri formats, which are not checked. Not for repairing broken JSON syntax or for checking whether a schema works with OpenAI, Claude or Gemini (jig_check_schema).

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "schema": "<schema>"
    },
    "name": "jig_validate_json"
  }
}

Input Schema

NameRequiredDescriptionDefault
dataNoThe JSON value to check: object, array, string, number, boolean or null. Use this or json_text.
draftNoForce a draft: 2020-12, 2019-09, 7, 6 or 4. Default: from $schema, else 2020-12.
schemaYesThe JSON Schema, as a JSON object (not a string). $schema picks the draft; default 2020-12.
json_textNoRaw text that should contain one JSON value, for example a model reply. Code fences and text around the JSON are stripped. Use this or data.
max_errorsNoMost errors to list (default 50). error_count is always the full count.
check_formatsNoCheck "format" (email, date-time, uuid, uri, ...). Default true.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.6/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already establish readOnly/idempotent/non-destructive, and the description adds substantial context beyond them: code-fence and prose stripping, line/column on syntax errors, supported drafts and keywords, format list, error cap behavior, and a frank coverage statement (6,018/6,227 suite cases, external $refs not fetched, $dynamicRef and idn-*/iri formats unchecked). The only shortfall is that the mutual exclusivity/priority of data vs json_text when both are supplied is never stated.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the usage trigger before the mechanics, and the closing 'Not for...' clause is well placed. The middle is a single very long sentence with stacked parentheticals (formats list, conformance statistics) that is dense to parse, though nearly every clause carries information an agent needs.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

There is no output schema, yet the description fully describes the return shape (valid true/false, per-error path, keyword, expected/got, and retry_message as a ready-to-send fix list). Combined with draft support, known limitations, and a worked example for a six-parameter tool, nothing essential is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 100% schema coverage the baseline is 3, and the description earns extra by explaining behavior the schema cannot: json_text tolerates fences and surrounding prose, a syntax error reports line and column, and draft selection defaults from $schema to 2020-12. It does not resolve what happens if both data and json_text are passed, which is the one semantic ambiguity left.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description names a specific verb and resource in the title line and body: validate a JSON value or raw model text against a JSON Schema, returning every error with its path. It explicitly distinguishes itself from jig_check_schema (compatibility checking) and from JSON syntax repair, so an agent can route correctly without opening schemas.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives an explicit 'Use when' trigger list with concrete user phrasing signals ('does this match the schema', 'check the tool-call arguments'), plus named exclusions with the alternative tool for each (jig_check_schema for provider compatibility, not for repairing broken syntax). Both when-to-use and when-not-to-use are covered.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources