Skip to main content
Glama
AgentTanuki

Agent Guild

ag_json_repair

Repair malformed JSON from LLM output or logs into parseable JSON. Use when standard parsing fails, returning the corrected value and repair steps.

Instructions

Repair malformed JSON (LLM output, logs) into parseable JSON.

Deterministically repairs almost-JSON: strips code fences and comments, converts single quotes and Python/JS literals (True/None/undefined), quotes bare keys, removes trailing commas, balances brackets. Returns the parsed value plus the exact repair steps applied. Use when a model or upstream tool emitted JSON that json.parse rejects.

Deterministic, fixture-verified, free for guests (rate-limited; pass your Guild api_key to use your member budget). Returns the result plus a Guild-signed provenance envelope.

payload MUST match this JSON Schema: {"type": "object", "properties": {"text": {"type": "string", "maxLength": 60000}}, "required": ["text"], "additionalProperties": false}

Output schema: {"type": "object", "properties": {"ok": {"type": "boolean"}, "parsed": {}, "repaired": {"type": "string"}, "changed": {"type": "boolean"}, "steps": {"type": "array", "items": {"type": "string"}}}, "required": ["ok", "parsed", "repaired", "changed", "steps"], "additionalProperties": false}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
api_keyNo
payloadYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

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

  1. First observedv2.7.0

TDQS

A3.6/5.0
Behavior4/5

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

Describes the exact repair operations, deterministic nature, returned steps/provenance, and rate-limit/api_key context. It does not detail failure behavior, but the output schema partially covers that via the 'ok' field.

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?

Most sentences carry relevant behavior or usage information, but the description duplicates a payload schema that conflicts with the input schema and includes marketing-style phrases, adding noise.

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

Completeness3/5

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

The output schema and repair-operation details are present, but the description omits failure/error behavior and does not explain the relationship between payload, text, and the output fields, especially given the inconsistent payload schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description's embedded payload schema requires a 'text' property and additionalProperties false, contradicting the input-schema, which declares payload as an object with additionalProperties true. The api_key parameter is only vaguely mentioned and no field-level semantics are provided.

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?

Description clearly states the tool repairs malformed JSON into parseable JSON and identifies the trigger use case ('JSON that json.parse rejects'), distinguishing it from sibling validation/utility tools.

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

Usage Guidelines4/5

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

Provides an explicit when-to-use condition, but does not explicitly name alternatives or say when not to use this tool.

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

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/AgentTanuki/agent-guild'

If you have feedback or need assistance with the MCP directory API, please join our Discord server