Skip to main content
Glama

Reparar JSON roto

json-repair
Read-onlyIdempotent

Repara JSON casi válido típico de salidas de LLM (comillas simples, comas, claves sin comillas, True/None, llaves sin cerrar) y devuelve el valor y los arreglos. Cuándo: un modelo devolvió JSON casi válido que hay que leer sin volver a pedírselo al modelo. No para: verificar si un texto es JSON válido (json-parse-check). Efectos secundarios: ninguno (solo lectura, sin red, sin estado guardado). Determinista: la misma entrada da la misma salida. Límites: entrada JSON de hasta 64 KB, 1 s por llamada, resultado de hasta 1 MB.

EN: Repairs almost-JSON typical of LLM output (code fences, comments, single quotes, unquoted keys, trailing or missing commas, Python True/False/None, NaN, unclosed strings and brackets) and returns the parsed value and the fixes applied. When: a model returned almost-valid JSON that has to be parsed without asking the model again. Not for: checking whether text is valid JSON (json-parse-check). [EN completo / full EN: inputSchema.description]

Input Schema

NameRequiredDescriptionDefault
textYesBroken JSON text (string; required).

Output Schema

NameRequiredDescriptionDefault
jsonNoany JSON value
fixesNo
valueNoany JSON value
changedNo
repairedNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / properties / text / examples
      Added value: +[
      +  "```json\n{name: 'Ana', 'tags': ['a', 'b',], active: True, // ok\n score: NaN}\n```"
      +]
  2. Changed1 schema field changed
    • addedInput schema / description
      Added value: +"EN: Repairs almost-JSON typical of LLM output (code fences, comments, single quotes, unquoted keys, trailing or missing commas, Python True/False/None, NaN, unclosed strings and brackets) and returns the parsed value and the fixes applied. When: a model returned almost-valid JSON that has to be parsed without asking the model again. Not for: checking whether text is valid JSON (json-parse-check). Side effects: none (read-only, no network access, no stored state). Deterministic: the same input gives the same output. Limits: JSON input up to 64 KB, 1 s per call, result up to 1 MB."
  3. First observed

TDQS

A4.2/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint, destructiveHint=false and openWorldHint=false, so the safety profile is covered; the description nonetheless adds genuinely new facts — determinism, no network, no stored state, and hard limits (64 KB input, 1 s, 1 MB result). Slight deduction because the stated 64 KB input cap conflicts with the schema's maxLength of 1048576 (1 MB), which could mislead an agent about the real limit.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Well front-loaded and labeled (Cuándo / No para / Efectos secundarios / Límites), but the content is duplicated verbatim in Spanish and English and then delegated again via '[EN completo / full EN: inputSchema.description]', which repeats text already present in the schema. Roughly half the tokens are redundant.

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?

An output schema exists, so return format needn't be explained, and the description still covers scope, exclusions, side effects, determinism and limits. The only real gap is the inconsistent input-size limit between description and schema, which an agent would need resolved.

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?

Only one parameter and schema description coverage is 100%, so the schema already carries the semantics including a rich broken-JSON example and maxLength. The description adds no per-parameter syntax or format guidance beyond that, so the baseline of 3 applies.

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 concrete verb and resource ('Repairs almost-JSON') and enumerates the exact defect classes it handles (code fences, comments, single quotes, unquoted keys, Python literals, NaN, unclosed brackets). It also contrasts itself with the sibling 'json-parse-check', so an agent can route without opening either schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicit 'Cuándo' clause gives the triggering condition (a model returned almost-valid JSON to be parsed without re-prompting) and 'No para' names the alternative tool (json-parse-check) for the opposite case. Both when-to-use and when-not-to-use are stated outright.

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