Skip to main content
Glama

json_validate

Read-only

Validate JSON text, identify its root type, and return compact normalized JSON (object keys sorted) plus a SHA-256 hash of it. Use it to check model or API output before parsing, or to compare two documents by hash; to read one field use json_extract. Runs without network access and does not store your input. Input up to 100,000 bytes (larger input is an error); trailing data after the first value counts as invalid. Returns valid, root_type, normalized_json, bytes and sha256; invalid JSON returns valid false with the parser error instead of failing. normalized_json escapes <, > and & as \u003c, \u003e and \u0026, and sha256 is the hash of that string.

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": {
      "json": "<json>"
    },
    "name": "json_validate"
  }
}

Input Schema

NameRequiredDescriptionDefault
jsonYesJSON text to validate, up to 100 KB.
l402_proofNoL402 payment proof "<macaroon>:<preimage>". Omit on the first call; an unpaid call returns a 0 sat Lightning invoice and the macaroon. Pay the invoice, then repeat the call with this argument set.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / l402_proof / description
      Previous value: -"L402 payment proof \"<macaroon>:<preimage>\". Omit on the first call; an unpaid call returns a 5 sat Lightning invoice and the macaroon. Pay the invoice, then repeat the call with this argument set."New value: +"L402 payment proof \"<macaroon>:<preimage>\". Omit on the first call; an unpaid call returns a 0 sat Lightning invoice and the macaroon. Pay the invoice, then repeat the call with this argument set."
  2. Changed1 schema field changed
    • addedInput schema / properties / l402_proof
      Added value: +{
      +  "description": "L402 payment proof \"<macaroon>:<preimage>\". Omit on the first call; an unpaid call returns a 5 sat Lightning invoice and the macaroon. Pay the invoice, then repeat the call with this argument set.",
      +  "type": "string"
      +}
  3. Added

TDQS

A4.6/5.0
Behavior5/5

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

Beyond the annotations (readOnlyHint/destructiveHint already cover the safety profile), the description discloses no network access, no input storage, a 100,000-byte cap with larger input treated as an error, trailing-data invalidity, and the non-failing error contract where invalid JSON returns valid=false with a parser error. It also explains the escaping applied to normalized_json and that sha256 is the hash of that escaped string, which is essential for correctly comparing hashes. The only tension is the annotation openWorldHint=true versus the stated lack of network access, but that reads as the tool not fetching URLs rather than a contradiction of the core claim.

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?

Purpose and usage are front-loaded, and nearly every clause carries information (limits, error semantics, escaping, hash definition). It is on the dense side, with return-field details split across two sentences (the field list and the later normalized_json/sha256 note), which could be consolidated, but there is no filler.

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, so the description carries the return contract itself and does so fully: valid, root_type, normalized_json, bytes, sha256, plus the invalid-JSON shape. For a two-parameter read-only validator, the only unmentioned behavior is the L402 payment gate, which the input schema documents explicitly.

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 both parameters are already documented, including the L402 payment flow that the description never mentions. The description adds the trailing-data rule and restates the size limit, but contributes no new meaning about the json or l402_proof arguments. Baseline 3 applies when the schema carries this much weight.

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 first sentence names a specific verb and resource (validate JSON text) plus the three concrete outputs: root type, normalized JSON, and a SHA-256 hash. It explicitly distinguishes itself from json_extract ("to read one field use json_extract"), so an agent can separate the two without opening either schema.

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 two concrete use cases (checking model/API output before parsing, comparing documents by hash) and names the alternative tool plus the condition that selects it ("to read one field use json_extract"). The routing decision is fully specified rather than implied.

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