Skip to main content
Glama

repair_malformed_json

Repair malformed JSON from LLMs by fixing truncated strings, unclosed quotes, missing braces, trailing commas, and single-quoted values.

Instructions

Repairs truncated JSON, unclosed quotes, missing closing braces, trailing commas, and single-quoted strings emitted by LLMs. (0.005 USDC on Base L2)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
payloadYesInput parameters or JSON string payload for the tool execution
paymentSignatureNoBase L2 USDC micropayment signature or transaction hash for x402 settlement

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

B3.2/5.0
Behavior2/5

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

No annotations are present, so the description must carry the full behavioral burden. It discloses the types of repairs and a cost (0.005 USDC on Base L2), but it does not mention return format, error behavior, whether paymentSignature is actually required, or any side effects. This leaves critical invocation-time behavior implicit.

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?

One dense sentence with a parenthetical cost note. The action and defect list are front-loaded, and every part contributes to the agent's understanding of what the tool repairs. No filler, no restating of the tool name, and no unnecessary detail.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with no output schema, no annotations, and a payment-related parameter, the description lacks key invocation context: it never says what the tool returns, whether paymentSignature must always be supplied, or when it should be used relative to nearby JSON tools like `llm_structured_json_schema_repair`. The repair scope is clear, but the overall operational picture is incomplete.

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 description coverage is 100%, so the baseline is 3. The description adds no real parameter-specific meaning beyond implying that `payload` contains the malformed JSON string; the schema descriptions themselves are generic and do not explain how to obtain or supply the payment signature. The description neither harms nor meaningfully enhances parameter understanding.

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 gives a specific verb ('Repairs'), a resource ('JSON'), and enumerates concrete defect types: truncated JSON, unclosed quotes, missing closing braces, trailing commas, and single-quoted strings. It is clearly distinct from generic 'repair' phrasing, but it does not explicitly differentiate itself from the sibling `llm_structured_json_schema_repair`, so it misses the top score.

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 phrase 'emitted by LLMs' implies a common use case, but there are no explicit when-to-use or when-not-to-use instructions, nor any mention of alternatives among the many sibling tools. An agent cannot tell whether `repair_malformed_json` is preferred over `llm_structured_json_schema_repair` for a given malformed payload.

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

Deploy Server

Other Tools