Skip to main content
Glama

json_format

Validate and pretty-print JSON strings with configurable indent width (2 or 4 spaces). Detects parse errors in raw or minified JSON and returns formatted output or error details.

Instructions

Validate and pretty-print a JSON string at a configurable indent width (2 or 4 spaces). Use to detect parse errors in raw JSON or to normalize minified JSON for readability; for schema validation or data transformation, apply your own logic. Runs JSON.parse + JSON.stringify locally with no network calls. On success, returns the formatted JSON string. On parse failure, returns an error message describing the position and nature of the syntax error.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputYesRaw JSON text to validate and format. May be minified or already pretty-printed.
indentNoIndentation width in spaces. Accepts 2 or 4; defaults to 2 if omitted.
Behavior5/5

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

Describes the internal operation (JSON.parse + JSON.stringify), states it makes no network calls, and explains both success and failure outcomes, fully compensating for missing 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?

Concise, front-loaded with main purpose, followed by usage guidance and technical details. Every sentence adds value with no redundancy.

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?

Covers input requirements, parameter options, behavior, error handling, and return values despite no output schema. Complete for a validation/formatting tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Adds meaningful context beyond schema: for input, mentions minified/pretty-printed state; for indent, specifies defaults and accepted values. Schema coverage is 100% so baseline 3, but description adds extra clarity.

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 the tool validates and pretty-prints JSON strings at configurable indent, distinguishing it from sibling tools that handle encoding, decoding, or lookups.

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?

Explicitly says to use for parse error detection or normalizing JSON, and advises using own logic for schema validation or transformation, providing clear when-to-use and alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/hikmahtech/drwhome'

If you have feedback or need assistance with the MCP directory API, please join our Discord server