Skip to main content
Glama

Deterministic Malformed JSON Syntax & Truncation Healer

heal_malformed_json
Read-onlyIdempotent

Deterministic JSON syntax repair: normalizes quotes, unclosed brackets, and boolean literals into compliant RFC 8259 JSON structure without data deletion. Use when fixing syntax-broken JSON strings that fail JSON.parse(); for coercing field types and verifying properties on already-parseable JSON objects against a target JSON Schema, use enforce_json_schema_types instead. Read-only edge call (32 KB, 60 RPM): accepts 'malformed_json' (with enum defaults), uses '?demo=true' or L402 (15 sats); HTTP 400 if invalid.

Input Schema

NameRequiredDescriptionDefault
repair_modeNoBracket-closing and literal-normalization strategy; defaults to 'heuristic_fast' when omitted.
malformed_jsonYesRaw broken, truncated, or markdown-wrapped JSON string to repair.

Output Schema

NameRequiredDescriptionDefault
statusYesRepair outcome ('repaired' or 'valid_as_is').
fixes_appliedYesList of lexical repairs performed.
parsed_objectYesDeserialized JSON object produced from the repaired string.
repaired_jsonYesValid RFC 8259 JSON string after syntax healing.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already cover readOnly/idempotent/non-destructive, but the description adds genuinely new operational context: a 32 KB payload cap, 60 RPM rate limit, access via '?demo=true' or L402 payment (15 sats), and HTTP 400 on invalid input. It also credits the non-destructive guarantee ('without data deletion'). Minor gaps only: no guidance on what happens when repair is ambiguous or partially successful.

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 capability, then sibling routing, then operational constraints, in a logical order with no filler sentences. It is fairly dense in a single paragraph, and the pricing/rate-limit detail is packed tightly, but every sentence carries usable information.

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?

Output shape is covered by an existing output schema, and the description supplies the size limit, auth/payment path, rate limit, and failure code an agent needs before calling. The only shortfall is that repair_mode behavior differences (heuristic_fast vs strict_rfc8259 vs close_truncated_stream) are not characterized beyond what the enum itself says.

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?

Schema coverage is 100%, so both parameters are already documented in the schema, including the repair_mode enum and its default. The description only alludes to them in passing ('accepts malformed_json (with enum defaults)'), adding no real semantic depth beyond the schema — baseline 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?

Specific verb (repair/heal) plus resource (malformed JSON) with explicit scope: quote normalization, bracket closing, literal normalization to RFC 8259. It also names the boundary against the closest sibling, enforce_json_schema_types, so an agent can distinguish the two 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?

Gives a concrete trigger condition ('syntax-broken JSON strings that fail JSON.parse()') and an explicit exclusion routing to enforce_json_schema_types for already-parseable objects needing type coercion or schema validation. Both the when and the when-not are stated.

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.