Skip to main content
Glama

Payload Validator

Validate JSON

validate_json
Read-only

Validates a JSON document and reports every problem with an exact line and column.

Use this whenever you need to know why a JSON payload is failing, or to check a JSON document you or a user produced before sending it somewhere that will reject it.

Do not do this by reading the JSON yourself. Three of the findings are invisible to inspection and to JSON.parse alike: (1) Duplicate keys. {"port":8080,"port":9090} is accepted by every mainstream parser, which keeps the last value and discards the first without a word. Reading it, you cannot see which one the consumer will use, because the answer differs by language. (2) Integer precision loss. 9007199254740993 parses as 9007199254740992 — quietly, because JSON numbers are IEEE-754 doubles in nearly every parser, exact only to 2^53-1. Any 64-bit ID (Twitter, Discord, most database bigints) is in the lossy range. This tool proves the loss with exact BigInt arithmetic rather than estimating it. (3) Lone surrogates. "\ud83d" alone is syntactically legal and cannot be encoded as UTF-8, so the document parses here and fails somewhere else entirely.

It also reports, with positions: trailing commas, comments, single-quoted strings, unquoted keys, Python literals (True/None/NaN/Infinity), leading zeros, hex numbers, unescaped control characters, raw line breaks inside strings, byte order marks, and trailing content — including recognising when the input is actually NDJSON being read as one document.

Input: input, the raw JSON text as a string. Not a parsed object — the text, because the findings are properties of the text. Up to 1,000,000 bytes.

Returns: valid (no errors), parseable (whether a conforming parser would accept it — deliberately separate, because a duplicate key parses fine and still means two different things), a diagnostics array where each entry has a 1-based line and column, a stable rule code, a message, an excerpt showing the offending line with a caret under the column, a fixHint, and blocksParse; plus counts and format-specific stats. Rule codes are stable and safe to branch on; messages are not.

Safety: nothing is resolved, fetched or expanded. External XML entities are reported, never retrieved; alias bombs are detected without being expanded; no schema or DTD is fetched over the network. Payloads are validated in memory and never stored.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputYesThe raw document text, not a parsed object — the findings are properties of the text. Up to 1,000,000 bytes.

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. First observed

TDQS

A4.5/5.0
Behavior5/5

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

The description goes far beyond the readOnlyHint annotation by explaining invisible failure modes, the separate parseable flag, stable rule codes, exact positions, input size limits, and the safety guarantees about not fetching, expanding, or storing payloads. This gives an agent a realistic model of what will happen when the tool runs.

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?

The description is long but every paragraph earns its place: purpose, when to use it, invisible failure classes, input constraints, return shape, and safety behavior. It is front-loaded with the main function and structured so an agent can quickly extract the decision-relevant information.

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?

Despite having no output schema, the description fully documents the return contract: valid, parseable, diagnostics with line/column/rule/message/excerpt/fixHint/blocksParse, plus counts and stats. It also covers safety and size limits, so an agent has enough context to call and interpret the tool correctly.

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 coverage is 100%, so the schema already documents the single input parameter. The description reinforces that input must be raw text, not a parsed object, but it largely repeats the schema's own wording rather than adding substantially new semantic meaning.

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 opens with a specific verb and resource: 'Validates a JSON document and reports every problem with an exact line and column.' It clearly distinguishes JSON validation from the sibling format validators and includes concrete examples of what it catches, so an agent can tell exactly what this tool does.

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?

The description gives an explicit trigger: 'Use this whenever you need to know why a JSON payload is failing, or to check a JSON document you or a user produced before sending it somewhere that will reject it.' It also warns against doing the check manually. It doesn't explicitly name validate_auto or the format-specific siblings as alternatives, but the JSON scope makes the boundary clear enough.

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.

TDQS

A4.7/5.0
Disambiguation5/5

Each tool targets a single unambiguous format (JSON, YAML, XML, CSV), and validate_auto is explicitly differentiated from the format-specific tools with guidance on when to prefer one over the other. The cross-references in the descriptions remove any possible confusion between the auto-detector and the dedicated validators.

Naming Consistency5/5

All five tools follow the exact same validate_<format> pattern with consistent snake_case naming. validate_auto fits the pattern naturally alongside validate_json, validate_yaml, validate_xml, and validate_csv, making the tool set predictable at a glance.

Tool Count5/5

Five tools is well-scoped for a payload validation server: auto-detection plus the four dominant text data formats. Each tool earns its place and there are no redundant or filler tools.

Completeness5/5

The validation surface is complete for the stated domain — the four major serialization formats are covered with deep edge-case handling, and validate_auto fills the gap for unknown formats. Possible additions like TOML or JSON Schema validation are outside the server's apparent scope and would be scope creep rather than natural missing coverage.

Resources