Skip to main content
Glama

JSON Formatter and Validator API - pretty print, minify, sort keys

json_formatter
Read-onlyIdempotent

Validate JSON and pretty-print or minify it, optional key sorting, with a clear error and position when invalid. Runs on our server, files are deleted right after the call, nothing stored. Free: 5 calls/day per IP. Paid: Radar API key (from €9/mo at https://radarbg.com/pricing#starter via X-API-Key) or $0.001/call via x402 at https://radarbg.com/x402/json-formatter.

Example tool call

This call uses example arguments supplied in the tool’s input schema.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "text": "{\"b\":1,\"a\":[1,2]}"
    },
    "name": "json_formatter"
  }
}

Input Schema

NameRequiredDescriptionDefault
modeNopretty or minifypretty
textYesThe text
indentNoIndent 2 or 42
sortKeysNoSort keys A-Z

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A3.7/5.0
Behavior4/5

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

Goes well beyond the readOnly/idempotent/openWorld annotations: server-side execution, files deleted immediately and nothing stored, and concrete rate limits (5 free calls/day per IP) plus paid auth paths via X-API-Key or x402. The only gap is no statement of what the successful response body looks like.

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 leads the description, followed by privacy guarantees, then access tiers — a sensible information order with no filler. The pricing/URL tail is longer than an agent strictly needs but is genuinely actionable for authentication.

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?

With no output schema, the description correctly covers the failure path (clear error and position) and adds operational constraints an agent needs before calling. Minor incompleteness: no description of the successful return shape or input size limits.

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 mode, indent, sortKeys, and text are already documented in the schema. The description only echoes key sorting and pretty/minify, adding no format or interaction detail (e.g., whether indent is ignored in minify mode). Baseline 3 applies.

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?

Specific verbs and resource: validate, pretty-print, minify, with optional key sorting and error reporting including position. An agent knows exactly what the tool produces. It does not explicitly contrast with the sibling json_repair_validate (format vs repair), so it stops short of 5.

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

Usage Guidelines3/5

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

Usage is implied by the purpose (format/validate JSON text), and the description supplies access/pricing conditions, but it never states when to pick this over json_repair_validate or json_to_yaml, nor any exclusions such as input size limits.

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