Skip to main content
Glama

heal_json_schema

Repair malformed LLM JSON and coerce it into strict schemas by fixing syntax errors, casting types, applying defaults, and validating against target JSON Schema contracts.

Instructions

    [Cost: $0.0005 USDC on Base & Solana] Universal LLM output JSON syntax healer and schema coercer.
    
    Keywords: repair malformed json, coerce tool arguments, json repair, schema coercer, heal json, parse broken json.
    Recovers broken LLM outputs: repairs malformed syntax (unquoted keys, missing brackets/quotes, trailing commas)
    and casts loose parameters into strict JSON Schema contracts (fuzzy enums, type conversions, missing defaults).

    Args:
        content: Raw broken JSON string or dictionary produced by an LLM.
        target_schema: Optional JSON Schema dictionary or string to validate and coerce against.
        mode: 'auto' (syntax repair first, then schema coercion if target_schema provided),
              'syntax_only' (pure syntax repair without type coercion),
              'coerce_only' (pure schema type casting).
        payment_signature: Optional x402 Base USDC transaction hash or developer mock key.
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modeNoauto
contentYes
target_schemaNo
payment_signatureNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.3.1

TDQS

A3.7/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does disclose important behavioral facts: the tool costs $0.0005 USDC on Base & Solana and payment_signature accepts an x402 transaction hash or developer mock key. Mode behaviors (syntax-first vs coercion ordering) are also explained. It stops short of describing failure/error behavior when output is unrecoverable.

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?

The cost line and Args section are front-loaded and useful, but the 'Keywords:' list ('repair malformed json, coerce tool arguments...') is redundant filler that restates the purpose for search rather than informing an agent. The Args block is well-structured, but the keyword sentence does not earn its place.

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 values needn't be explained, and the description covers cost, payment, all four parameters, and the three modes. Given the 0% schema coverage, this is close to complete; only error-handling behavior for unhealable input is missing.

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 0%, so the description must compensate, and it does: content ('raw broken JSON string or dictionary'), target_schema ('optional JSON Schema dictionary or string to validate and coerce against'), payment_signature (x402 hash or mock key). The three mode string values are enumerated with semantics even though the schema declares no enum, adding real value beyond the structured data.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb and resource: 'Universal LLM output JSON syntax healer and schema coercer', then concretizes it with 'repairs malformed syntax (unquoted keys, missing brackets/quotes, trailing commas) and casts loose parameters into strict JSON Schema contracts'. It does not, however, differentiate itself from overlapping siblings like repair_malformed_json or coerce_tool_arguments, leaving the agent to infer that this tool is a superset.

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 mode descriptions provide implicit usage guidance ('auto': syntax repair first, then schema coercion if target_schema provided; 'syntax_only'; 'coerce_only'), which tells the agent how to select a mode but not when to choose this tool over the sibling repair_malformed_json or coerce_tool_arguments. No exclusions or routing are given.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.