Validate JSON against a JSON Schema
json_schema_validateValidate JSON documents or raw LLM output against a JSON Schema, returning precise JSON Pointer and JSONPath errors or parse error line and column.
Instructions
Validates a JSON document (or raw model output text, optionally wrapped in a Markdown code fence) against a JSON Schema using Ajv with formats. Returns every error with a JSON Pointer and JSONPath to the offending value, or the line and column of a parse error. Supports draft-07, 2019-09, and 2020-12 (detected from $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": "json_schema_validate"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| draft | No | Override draft detection | |
| schema | Yes | The JSON Schema | |
| document | No | Parsed JSON value to validate | |
| maxErrors | No | Maximum errors (default 50) | |
| documentText | No | Raw JSON text to parse then validate (for example an LLM response) | |
| stripCodeFences | No | Strip a surrounding ``` fence (default true) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| draft | Yes | ||
| valid | Yes | ||
| errors | Yes | ||
| errorCount | Yes | ||
| parseError | No |