Skip to main content
Glama

x402 agent toolkit: service finder, payment safety, Solana & web tools

JSON repair (fix LLM output)

json_repair
Read-onlyIdempotent

Fix broken JSON from LLMs: code fences, leading prose, comments, single quotes, bare keys, trailing commas, Python True/None, truncated strings and unclosed brackets. Returns parsed JSON + list of fixes. Free: 10 calls/day; then $0.001/call via x402 (MCP params._meta["x402/payment"] or HTTP) or X-API-Key credits. [served by tools.moneytools.dev]

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": {
      "text": "<text>"
    },
    "name": "json_repair"
  }
}

Input Schema

NameRequiredDescriptionDefault
textYesbroken JSON text

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.6/5.0
Behavior5/5

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

Annotations already declare readOnly/idempotent/non-destructive/openWorld, and the description adds traits the annotations cannot carry: the response shape ('parsed JSON + list of fixes') and, critically, the commercial behavior — 10 free calls/day, then $0.001/call via x402 payment or X-API-Key credits. That cost/rate-limit/auth detail is exactly the kind of context an agent needs before invoking.

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-loaded with the core purpose and the fix taxonomy in one dense clause, with return value and pricing trailing. Nearly every phrase earns its place, though the x402/payment plumbing parenthetical is dense for a tool description and slightly slows scanning.

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?

For a single-required-param, read-only tool with both annotations and an output schema, nothing essential is missing: purpose, inputs, return shape, and cost/auth mechanics are all covered. Return-value details can safely be left to the output schema.

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?

There is only one parameter and schema coverage is 100%, with an illustrative broken example, so the schema carries the burden. The description still adds meaning by defining what 'broken' includes, which tells the agent what to pass rather than pre-cleaning it.

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') and then enumerates the exact failure classes it handles (code fences, leading prose, comments, single quotes, bare keys, trailing commas, Python True/None, truncated strings, unclosed brackets). That enumeration implicitly separates it from validators/formatters like json_format or json_schema_validate, which presuppose well-formed input.

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?

The phrase 'from LLMs' plus the list of malformed constructs gives a clear use context: call this when model output is almost-JSON but unparseable. It does not name an explicit alternative or state a when-not (e.g., 'use json_format for already-valid JSON'), so it stops short of full routing guidance.

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