Skip to main content
Glama

APEX AI, LLM, Embeddings, OCR & Media

Json repair

json_repair
Read-onlyIdempotent

Clean and repair broken JSON from LLM outputs or scraped text (fences, trailing commas, single quotes, bare keys, Python literals, truncated brackets) ($0.001). $0.001 per call over x402 (USDC on Arc, Base or Solana, or XNT on X1). Call once without payment for the terms, sign them with your own wallet, call again with payment.

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 or fenced JSON text to repair (up to 32000 chars)
paymentNoa signed x402 payment (the base64 payload you would put in PAYMENT-SIGNATURE). Pass it and the purchase completes inside this tool call.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already declare readOnly, idempotent, non-destructive, open-world behavior, so the safety profile is covered. The description adds substantial context the annotations cannot: this is a paid tool at $0.001 per call via x402 across several chains, and the first call returns payment terms rather than a result — critical behavior for an agent. It does not say what happens for unrepairable input or on payment failure.

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 repair categories, with payment mechanics pushed to the back where a user needs them. Minor waste: the price appears twice, once parenthetically and once spelled out with the payment rails.

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?

For a two-parameter repair tool with full schema coverage and a documented payment flow, this is nearly complete. The one omission is that, with no output schema, the description never states that it returns the repaired JSON string (or what a failure returns).

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 the schema by explaining the sequencing semantics of the optional `payment` parameter — obtain terms on an unpaid call, sign with your own wallet, then replay with the signed payload — which is meaning the schema alone does not convey.

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 and resource (clean and repair broken JSON) and enumerates the concrete failure modes handled: fences, trailing commas, single quotes, bare keys, Python literals, truncated brackets. An agent knows exactly what the tool does and on what inputs.

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 clear usage context — broken JSON from LLM outputs or scraped text — plus an explicit operational sequence: call once without `payment` for terms, sign, call again with `payment`. It stops short of naming when NOT to use it or pointing to alternatives, but the applicability condition is unambiguous.

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.