Skip to main content
Glama

Format a JSON document

format_json
Read-only

Format (pretty-print or minify) a JSON document, optionally sorting object keys. Number literals are preserved exactly (64-bit IDs safe); parse errors report the exact line and column.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
jsonYesThe JSON text to format.
indentNoIndentation: '2' or '4' spaces, 'tab', or 'minify'. Defaults to '2'.
sort_keysNoSort object keys alphabetically. Defaults to false.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.1/5.0
Behavior4/5

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

Annotations already indicate readOnlyHint=true (safe read operation). The description adds valuable behavioral details beyond annotations: number literals are preserved exactly (64-bit safe) and parse errors report exact line and column. No contradiction with annotations.

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 consists of two concise sentences that front-load the core action (format JSON), then add key behavioral traits. Every sentence is purposeful with no redundancy or 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?

For a simple 3-parameter tool with no output schema, the description covers the main functionality, error behavior (parse errors), and a notable edge case (64-bit number safety). Sibling tools exist but do not demand more detail. The description is fully adequate.

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 baseline 3 is appropriate. The description adds minimal parameter insight beyond the schema—it mentions 'optionally sorting object keys' (sort_keys) and 'pretty-print or minify' (indent), which are already documented in the schema. No additional semantic depth.

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 clearly states it formats a JSON document (pretty-print or minify), with optional sorting of keys. This verb+resource combination is specific to JSON, distinguishing it from sibling tools ask_codefmt and format_code, which likely handle other code formats.

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?

The description implies this tool is for JSON formatting, and siblings likely cover other languages/formats, but it does not explicitly state when to use this versus ask_codefmt or format_code. No when-not or alternative guidance is provided, leaving the agent to infer usage.

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