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: 25 calls/day per IP. Paid: $0.001 per 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. First observed

TDQS

A4.3/5.0
Behavior5/5

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

Beyond the readOnly/idempotent annotations, the description adds material behavior: processing happens server-side, files are deleted immediately after the call, nothing is stored, and there are concrete rate limits and pricing. These are exactly the operational facts an agent needs before invoking a hosted formatter.

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?

Two sentences, front-loaded with the core action and followed by privacy, quota, and pricing facts. Dense but every clause carries information; the pricing URL is slightly bulky but justified for a paid endpoint.

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 compensates by describing the success output (pretty-printed or minified JSON) and the error output (clear error with position). Combined with the disclosed limits and privacy behavior, an agent has enough to call it correctly; only return-shape specifics like exact error field names are absent.

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% and enums are declared for mode and indent, so the schema already carries the parameter meaning. The description only restates 'optional key sorting' and adds no format or interaction details beyond the structured fields, making the baseline 3 appropriate.

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 names specific verbs and resources: validate JSON, pretty-print, minify, and optionally sort keys. It also states the failure behavior (clear error with position), so an agent knows exactly what the tool produces without opening the schema.

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?

It gives clear context for use (formatting/validating JSON text) and discloses the operational envelope: 25 free calls/day per IP and $0.001 per call via x402. It does not state explicit when-not-to-use conditions or name an alternative, but no sibling in the catalog overlaps with JSON formatting, so the practical gap is small.

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