Skip to main content
Glama

Agent Data Tools: Utilities

Repair broken JSON

json_repair

Fix JSON as LLMs often write it: removes json fences and surrounding prose, comments and trailing commas, converts single quotes, quotes bare keys, maps True/False/None, and closes unclosed brackets. Returns the repaired JSON and whether it now parses. Use when an LLM's JSON output fails to parse. Example: text=json {name: 'Ada', tags: ['x',],}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYesThe broken JSON text

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Discloses pricing ($0.003/call via x402 USDC or card key), a free tier (first 25 free, failed calls free), and the return shape (repaired JSON plus whether it parses). Crucially it explains the non-obvious annotation: 'not marked read-only because each call is charged', reconciling readOnlyHint=false rather than leaving the agent to guess.

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 action and enumerates repairs before the example and billing details, so the agent gets the essence immediately. The billing/pricing sentences are dense and somewhat verbose but each still earns its place by explaining the pricing and the non-read-only annotation.

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?

With no output schema, the description still covers the return values (repaired JSON and parse success), the usage context, the cost model, and the annotation rationale. Nothing an agent needs to call this correctly is missing.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3. The description goes beyond it with a concrete example input, text=```json {name: 'Ada', tags: ['x',],}, showing the kind of broken input the single 'text' parameter expects, which adds practical meaning over the schema's terse 'The broken JSON text'.

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 (Fix/Repair) and resource (JSON) and enumerates the exact transformations performed (fence removal, comments, trailing commas, single quotes, bare keys, True/False/None, bracket closing). This clearly distinguishes it from siblings like json_validate, json_format, and json_minify without opening any schema.

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?

Gives a precise trigger: 'Use when an LLM's JSON output fails to parse.' That is a clear when-to-use condition. It does not explicitly name or exclude alternatives (e.g. json_validate for well-formed input), so it falls just short of the 5 bar.

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.