Skip to main content
Glama

Fix broken JSON

json_repair
Read-onlyIdempotent

Turns almost-JSON into valid JSON: removes markdown code fences, comments and trailing commas, adds missing quotes, commas and closing brackets, converts single quotes, Python True/False/None and truncated output. Returns the repaired JSON string and whether the input was already valid.

Input Schema

NameRequiredDescriptionDefault
textYesThe broken JSON text
prettyNoIndent the output. Default false.

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, idempotentHint, destructiveHint=false and openWorldHint=false, so the safety profile is covered. The description adds genuinely new context: the return payload ('the repaired JSON string and whether the input was already valid'), which matters because there is no output schema. It stops short of describing failure/irreparable-input behavior.

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?

A single dense sentence, front-loaded with the core transformation and then the specific repairs, closing with the return contract. Every clause carries information; nothing is padding.

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 correctly compensates by naming the two returned values, and the repair catalog makes scope clear. It omits what happens on unrepairable input and does not mention the 500,000-character limit, minor gaps for a deterministic, low-risk utility.

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% for both parameters ('The broken JSON text', 'Indent the output. Default false.'), so the schema fully documents them. The description adds no syntax, format, or size guidance for the inputs, so the baseline 3 is appropriate.

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?

Specific verb and resource ('Turns almost-JSON into valid JSON') followed by an enumerated list of the exact repairs performed, so the tool is unmistakably a repairer rather than a validator. It does not name the closest sibling (json_schema_validate) or explicitly contrast against it, which keeps it short of a 5.

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 phrase 'almost-JSON' implies the trigger condition (malformed/truncated JSON), but the description never states when to use this versus json_schema_validate or what to do with input that is already valid. Usage is implied rather than instructed.

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