Skip to main content
Glama

Validate JSON against a JSON Schema

ai_json_schema_validate
Read-onlyIdempotent

Validate JSON data against a JSON Schema and report all validation errors with instance and schema paths, keywords, messages, and parameters.

Instructions

Validate JSON data against a JSON Schema with Ajv, reporting every error (allErrors) with its instancePath (JSON Pointer), schemaPath, keyword, message and params. Draft 2020-12 is used when the schema's $schema says 2020-12 (2019-09 likewise), otherwise draft-07 (draft-04/06 schemas are checked as draft-07). Formats checked: date, time, date-time, email, hostname, ipv4, ipv6, uri, uri-reference, uuid, regex, json-pointer (other formats are ignored and listed). Data: inline "data" (any JSON value), "dataText" (JSON text) or "dataFile" (path or base64). Schema: inline "schema" (object or JSON text) or "schemaFile". Remote $ref URLs are never fetched. Runs locally.

Input Schema

NameRequiredDescriptionDefault
dataNoThe JSON value to validate, inline (a string here is validated as a string; use dataText for JSON text).
schemaNoThe JSON Schema inline: an object (or JSON text).
dataFileNoOr: a JSON file (local path or base64).
dataTextNoOr: the data as JSON text.
maxErrorsNoMost errors to return (default 100).
schemaFileNoOr: a JSON Schema file (local path or base64).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.7/5.0
Behavior5/5

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

Annotations cover the safety profile (readOnly, idempotent, openWorld=false), yet the description still adds substantial behavioral detail: allErrors reporting with instancePath/schemaPath/keyword/message/params, draft resolution rules ($schema-driven 2020-12/2019-09, else draft-07, with 04/06 coerced), which formats are actually checked versus ignored and listed, and that remote $ref URLs are never fetched because it runs locally.

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?

Front-loaded with purpose, then error reporting, then draft handling, then formats, then input plumbing, then the no-remote-fetch guarantee. Dense but every clause carries non-obvious information; no filler or restatement of the title.

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?

With no output schema, the description takes responsibility for describing the return payload (per-error fields) and caps behavior via maxErrors context. Draft support, format coverage, and the no-network guarantee fill in the remaining gaps an agent would otherwise have to guess at.

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?

Schema coverage is already 100%, so baseline would be 3; the description earns above that by grouping the six parameters into data sources and schema sources and clarifying the edge case that an inline string in 'data' is validated as a string rather than parsed. maxErrors is left to the schema, which is acceptable given its explicit description.

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?

Opens with a specific verb+resource: 'Validate JSON data against a JSON Schema with Ajv', then narrows to what is reported. This is unambiguously distinct from the sibling ai_json_schema_infer (which produces schemas rather than checking data) even without naming it.

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?

Gives explicit selection guidance among the alternative input modes — inline 'data' vs 'dataText' vs 'dataFile', and 'schema' vs 'schemaFile' — with the crucial caveat that a string passed as 'data' is validated as a string. It stops short of stating when to prefer this tool over sibling tools such as json_format or ai_json_schema_infer.

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

Deploy Server

Other Tools