Skip to main content
Glama

Validate JSON against a schema

json_schema_validate
Read-onlyIdempotent

Checks a JSON value against a JSON Schema (drafts 4, 7, 2019-09 and 2020-12) and lists every violation with its location. Use it to confirm structured output or an API payload is correct before sending it. data and schema may be JSON values or JSON strings.

Input Schema

NameRequiredDescriptionDefault
dataYesThe JSON value to check (any type), or a JSON string of it
draftNoDefault 2020-12
schemaYesThe JSON Schema (object), or a JSON string of it

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint, destructiveHint=false and openWorldHint=false, so safety is covered. The description adds genuinely new behavior: the output shape ("lists every violation with its location") and the accepted input flexibility (values or JSON strings), which the annotations cannot express.

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

Conciseness5/5

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

Three tight sentences, each doing distinct work: capability+scope, when to use, then a parameter caveat. Front-loaded with the capability statement and free of filler.

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

Completeness4/5

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

For a deterministic, read-only validator with only three well-documented parameters, the definition covers purpose, usage, scope and output shape. It leaves failure semantics (e.g. invalid input vs. invalid schema) unstated, and there is no output schema to fall back on, so it is complete but not exhaustive.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already documents all three parameters including the JSON-string fallback and the draft default. The description's restatement of drafts and JSON-string acceptance is largely redundant, so it earns only the baseline 3.

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

Purpose4/5

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

The description gives a precise verb+resource ("Checks a JSON value against a JSON Schema") plus scope detail — supported drafts and the fact that it "lists every violation with its location." An agent can immediately tell this is a full schema validator rather than a format check, though it never names the nearest sibling (json_repair) to draw the contrast explicitly.

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

Usage Guidelines4/5

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

"Use it to confirm structured output or an API payload is correct before sending it" states a concrete when-to-use scenario. It gives no exclusions or named alternatives (e.g. json_repair for malformed input), so it stops short of full routing guidance.

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