Skip to main content
Glama

json repair

json_repair
Read-only

Fix broken JSON from model output: strips code fences and chatter, single quotes, unquoted keys, trailing or missing commas, comments, Python True/None, and closes truncated strings and brackets; falls back to AI repair for the rest. Returns the parsed JSON and what was fixed. Costs $0.004 USDC per call (x402).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYes
use_aiNoDefault true (texts up to 6,000 characters)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / use_ai / description
      Previous value: -"Default true (texts up to 8,000 characters)"New value: +"Default true (texts up to 6,000 characters)"
  2. Added

TDQS

A3.9/5.0
Behavior4/5

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

Annotations already cover the read-only safety profile, but the description adds substantial non-annotation context: the deterministic-then-AI-fallback strategy, the return shape ('parsed JSON and what was fixed'), and the paid x402 cost per call. This goes well beyond what readOnlyHint/openWorldHint convey.

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?

Front-loads the core purpose, then layers the enumerated fixes, return shape, and cost in a compact three-sentence block. Dense but every clause carries information; no filler.

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 compensates by stating what is returned, and it discloses the fallback path and cost. Only the text parameter's semantics and any size limits are left implicit, a minor gap for a 2-param tool.

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 50%; the use_ai param has its own description and default, while text is undocumented. The description's mention of 'falls back to AI repair' loosely gestures at use_ai but adds no syntax or size guidance beyond the schema. Baseline 3 is appropriate.

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 a specific verb+resource ('Fix broken JSON from model output') and enumerates exact repair classes (fences, quotes, commas, comments, Python literals, truncation). An agent can easily distinguish this from the sibling json_validate, which validates rather than repairs.

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?

Implies usage from the phrase 'broken JSON from model output', but never states when to use this versus json_validate, nor any exclusions or prerequisites. Usage is inferable but not explicit.

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