Skip to main content
Glama

JSON Formatter

format_json
Read-onlyIdempotent

Use this when you need to check whether JSON is valid or make it readable. Example prompt: "Why does this JSON fail to parse?" Validate and pretty-print JSON with a real parser. Returns formatted JSON or the exact parse error. Costs 1 credit. The answer is deterministic.

Input Schema

NameRequiredDescriptionDefault
jsonYesThe JSON text to validate and format
indentNoSpaces per indentation level, 0 to 8 (default 2)

Output Schema

NameRequiredDescriptionDefault
validNoWhether the input passed every check
outputNoThe final output of the workflow
resultNoThe result, when it is not an object

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • removedInput schema / $schema
      Removed value: -"https://json-schema.org/draft/2020-12/schema"
    • removedOutput schema / $schema
      Removed value: -"https://json-schema.org/draft/2020-12/schema"
  2. Changed3 schema fields changed
    • addedInput schema / properties / indent / description
      Added value: +"Spaces per indentation level, 0 to 8 (default 2)"
    • addedInput schema / properties / json / description
      Added value: +"The JSON text to validate and format"
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "https://json-schema.org/draft/2020-12/schema",
      +  "additionalProperties": {},
      +  "properties": {
      +    "output": {
      +      "description": "The final output of the workflow",
      +      "type": "string"
      +    },
      +    "result": {
      +      "description": "The result, when it is not an object"
      +    },
      +    "valid": {
      +      "description": "Whether the input passed every check",
      +      "type": "boolean"
      +    }
      +  },
      +  "type": "object"
      +}
  3. Changed3 schema fields changed
    • removedInput schema / properties / indent / description
      Removed value: -"Spaces per indentation level, 0 to 8 (default 2)"
    • removedInput schema / properties / json / description
      Removed value: -"The JSON text to validate and format"
    • changedOutput schema / (root)
      Previous value: -{
      -  "$schema": "https://json-schema.org/draft/2020-12/schema",
      -  "additionalProperties": {},
      -  "properties": {
      -    "output": {
      -      "description": "The final output of the workflow",
      -      "type": "string"
      -    },
      -    "result": {
      -      "description": "The result, when it is not an object"
      -    },
      -    "valid": {
      -      "description": "Whether the input passed every check",
      -      "type": "boolean"
      -    }
      -  },
      -  "type": "object"
      -}New value: +null
  4. Changed3 schema fields changed
    • addedInput schema / properties / indent / description
      Added value: +"Spaces per indentation level, 0 to 8 (default 2)"
    • addedInput schema / properties / json / description
      Added value: +"The JSON text to validate and format"
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "https://json-schema.org/draft/2020-12/schema",
      +  "additionalProperties": {},
      +  "properties": {
      +    "output": {
      +      "description": "The final output of the workflow",
      +      "type": "string"
      +    },
      +    "result": {
      +      "description": "The result, when it is not an object"
      +    },
      +    "valid": {
      +      "description": "Whether the input passed every check",
      +      "type": "boolean"
      +    }
      +  },
      +  "type": "object"
      +}
  5. Changed3 schema fields changed
    • removedInput schema / properties / indent / description
      Removed value: -"Spaces per indentation level, 0 to 8 (default 2)"
    • removedInput schema / properties / json / description
      Removed value: -"The JSON text to validate and format"
    • changedOutput schema / (root)
      Previous value: -{
      -  "$schema": "https://json-schema.org/draft/2020-12/schema",
      -  "additionalProperties": {},
      -  "properties": {
      -    "output": {
      -      "description": "The final output of the workflow",
      -      "type": "string"
      -    },
      -    "result": {
      -      "description": "The result, when it is not an object"
      -    },
      -    "valid": {
      -      "description": "Whether the input passed every check",
      -      "type": "boolean"
      -    }
      -  },
      -  "type": "object"
      -}New value: +null
  6. Changed3 schema fields changed
    • addedInput schema / properties / indent / description
      Added value: +"Spaces per indentation level, 0 to 8 (default 2)"
    • addedInput schema / properties / json / description
      Added value: +"The JSON text to validate and format"
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "https://json-schema.org/draft/2020-12/schema",
      +  "additionalProperties": {},
      +  "properties": {
      +    "output": {
      +      "description": "The final output of the workflow",
      +      "type": "string"
      +    },
      +    "result": {
      +      "description": "The result, when it is not an object"
      +    },
      +    "valid": {
      +      "description": "Whether the input passed every check",
      +      "type": "boolean"
      +    }
      +  },
      +  "type": "object"
      +}
  7. First observed

TDQS

A4.1/5.0
Behavior4/5

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

Annotations already declare readOnly, idempotent, non-destructive, and closed-world behavior, so the safety profile is covered. The description adds genuinely new context beyond that: a 1-credit cost, determinism, a 'real parser' implementation, and the two possible outcomes including error text.

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?

The purpose, example, mechanics, cost, and determinism are all front-loaded in a few short sentences. The example prompt is slightly redundant with the preceding sentence but earns its place by showing a real use case.

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 an output schema present, rich annotations, and full schema coverage, the remaining need is cost/behavior/error disclosure, which the description supplies. Nothing essential for correct invocation is missing.

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% and both parameters are documented with types, ranges, and defaults, so the schema carries the parameter burden. The description only implicitly touches formatting via 'make it readable' and never mentions the indent control, so it adds nothing over the schema. Baseline 3.

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?

States specific verbs and the resource: 'Validate and pretty-print JSON with a real parser', plus the dual outcome (formatted JSON or exact parse error). No sibling shares this function, so an agent can route here unambiguously.

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?

'Use this when you need to check whether JSON is valid or make it readable' gives an explicit trigger condition, reinforced by an example prompt about parse failure. It stops short of naming exclusions or contrasting with csv_to_json, but no real alternative exists for this task.

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