Skip to main content
Glama

repair_json

Repair malformed JSON (trailing commas, single quotes, truncation, markdown fences, comments, python literals) and optionally validate/coerce it against a JSON Schema. Deterministic repair is free. If it fails and allow_llm_fallback is true, a paid LLM repair is attempted (requires x402 payment; charged only on success).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputYesThe possibly-malformed JSON text
schemaNoOptional JSON Schema the output must conform to
allow_llm_fallbackNoPermit the paid LLM repair tier

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. First observed

TDQS

A4.2/5.0
Behavior4/5

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

No annotations are provided, so the description carries full burden. It discloses key behaviors: deterministic free repair, paid LLM fallback with payment requirement (x402, charged on success), and the ability to validate against a schema. This is transparent, though it could mention that the output is a repaired JSON string.

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?

Two sentences, no fluff. The first sentence front-loads the main purpose with specific examples. Every part is informative.

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?

Given the complexity (repair, validation, two-tier), the description covers the main aspects. It lacks an output description but the purpose is clear. Siblings are mentioned but not differentiated explicitly. Still adequate.

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%, but the description adds value by explaining the two-tier repair for allow_llm_fallback and the schema validation role. This goes beyond the schema's basic descriptions.

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?

The description clearly states the tool's purpose: repairing malformed JSON with specific examples (trailing commas, single quotes, truncation, etc.). It also mentions optional schema validation/coercion. This distinguishes it from siblings like extract_json or validate_json.

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 description explains the two-tier repair process (free deterministic vs paid LLM) but does not explicitly tell when to use this tool over siblings. While it's implied for malformed JSON, there is no direct comparison or exclusion criteria.

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.

TDQS

A4.4/5.0
Disambiguation5/5

Each tool has a clearly distinct purpose: extract JSON from text, infer schema from data, repair malformed JSON, and validate against a schema. There is no overlap or ambiguity.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern in snake_case (extract_json, infer_schema, repair_json, validate_json), making them predictable and easy to distinguish.

Tool Count5/5

With 4 tools, the server is well-scoped for its purpose of JSON handling. Each tool addresses a distinct need without excess or deficiency.

Completeness4/5

The tool set covers core JSON operations: extraction, schema inference, repair, and validation. Minor gaps exist (e.g., no transformation or generation), but the surface is largely complete for common tasks.