Skip to main content
Glama

repair_string

Read-onlyIdempotent

Deterministic repair engine. Given a raw LLM output that should contain JSON, this tool: (1) strips markdown code fences (```json), (2) regex-strips prose preambles/suffixes, (3) escapes unescaped control characters inside string values, (4) validates with json.loads — falling back to structural repairs and partial-recovery bracket closing when needed, and (5) optionally validates the repaired JSON against a JSON schema.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
schemaNoOptional JSON schema. When provided, the repaired JSON is validated against it. Validation errors are translated into a list of actionable 'Fix Action' strings.
api_key_idNoYour Stripe Customer ID, used for metered billing ($1.00/mo base includes first 100 requests; $0.01 each after).
raw_stringYesRaw text that should contain JSON.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.3/5.0
Behavior5/5

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

Annotations already mark the tool as read-only and idempotent, and the description adds substantial behavioral detail: stripping markdown fences, regex prose removal, escaping control characters, structural repairs, partial bracket closing, and optional schema validation with actionable Fix Actions.

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?

The description is dense but well-organized as a numbered list. Every step earns its place, and the opening phrase 'Deterministic repair engine' provides an immediate summary.

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?

The description thoroughly covers inputs, the repair process, and optional schema validation. The only notable gap is the lack of an explicit return type (e.g., repaired string vs parsed dictionary), especially since no output schema exists.

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 100%, so the structured fields already document all parameters. The description adds meaningful context for raw_string, schema (Fix Action translation), and api_key_id (billing), reinforcing and extending the schema descriptions.

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 opens with 'Deterministic repair engine' and lists a precise pipeline for repairing raw LLM output into JSON. It clearly distinguishes the tool's scope from siblings like validate_json, though it does not explicitly name sibling alternatives.

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?

The description clearly states the intended input ('raw LLM output that should contain JSON') and when optional schema validation applies. It does not explicitly contrast with repair_json, sanitize_json_output, or validate_json, but the context is sufficiently clear.

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