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.

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.

TDQS

A3.8/5.0
Disambiguation2/5

The three repair tools (repair_json, repair_string, sanitize_json_output) have heavily overlapping purposes. While repair_string has a more detailed description, an agent may struggle to choose between it, the generic repair_json, and sanitize_json_output, which also repairs control characters and removes prose. Only validate_json is clearly distinct.

Naming Consistency3/5

The names mix patterns: repair_json and repair_string use the 'repair' verb with different objects, while validate_json and sanitize_json_output use other verbs. The object naming is also inconsistent (json, string, json_output). Overall the set is readable but lacks a uniform convention.

Tool Count4/5

Four tools is a reasonable count for a JSON sanity server, fitting within the typical well-scoped range. However, the inclusion of three overlapping repair functions suggests the count could be trimmed without losing core functionality.

Completeness5/5

The server covers the full lifecycle for its stated purpose: validation (validate_json), repair (repair_json, repair_string), and sanitization (sanitize_json_output). It includes schema validation in repair_string, leaving no obvious gaps in the domain of ensuring JSON sanity.

Resources