Skip to main content
Glama

Format JSON

format_json
Read-only

Validates and pretty-prints JSON text with the requested indentation. Returns a clear error message when the input is not valid JSON.

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": {
      "jsonText": "<jsonText>"
    },
    "name": "format_json"
  }
}

Input Schema

NameRequiredDescriptionDefault
indentNoSpaces per indent level (0-8). 0 gives compact JSON.
jsonTextYesThe JSON text to format.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.8/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true, destructiveHint=false, and openWorldHint=false, so the safety profile is covered. The description adds genuinely new behavioral context by disclosing the failure path: invalid input yields 'a clear error message' rather than throwing or partially formatting, which matters for an agent deciding whether to pre-validate.

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?

Two sentences, front-loaded with the core action, and the secondary sentence covers the error case. No filler, no redundancy, and nothing restates the tool title verbatim.

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?

For a two-parameter pure function with full schema coverage and clear annotations, the definition covers what it does, its failure behavior, and its read-only nature. The only gap is that the success return shape (the formatted string) is left implicit, since no output schema exists to carry it.

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 the schema already documents both 'jsonText' and 'indent' (including the 0-8 range and that 0 means compact). The description only echoes the indentation concept ('with the requested indentation') and adds no syntax or format detail beyond the schema, so the 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?

The description names specific verbs ('validates', 'pretty-prints') and the exact resource ('JSON text'), so the agent knows precisely what the tool does. It does not need to distinguish itself from siblings like calculate_emi or generate_qr_code because the domains are obviously disjoint, but no explicit differentiation is stated.

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 rather than stated: an agent can infer this is the tool for formatting/checking JSON, and the mention of an error message hints at a validation use case. However, there is no explicit when-to-use guidance, no prerequisites, and no named alternatives for related tasks.

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