# AgentDiet Schema Repair

> AgentDiet Schema Repair is a paid API for AI agents from agentdiet.dev, paid per call via x402 or MPP, $0.002/call, status unknown (last checked 2026-10-20).

Deterministically repairs and validates malformed or truncated JSON output from LLMs so multi-agent pipelines can continue without crashing.

## Facts

- Endpoint: GET https://agentdiet.dev/v1/schema-repair?utm_source=zero.xyz
- Price: $0.002/call
- Payment: x402, MPP
- Status: unknown
- Last checked: 2026-10-20
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/agentdiet-schema-repair-ee0053f5
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_YnOUG7sUjHlwUIgyU-OYV

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability agentdiet-schema-repair-ee0053f5
```

Example prompt: I just got a JSON response from an LLM that has trailing commas and is wrapped in markdown fences — can you clean it up and give me a valid JSON object? Here's the raw output: ```{"name": "Alice", "age": 30,}```

## When to prefer this

Choose this endpoint when your multi-agent pipeline receives JSON from an LLM that fails to parse due to common formatting errors like trailing commas, markdown fences, single quotes, or truncation. It is a fast, deterministic (non-AI) repair layer, making it reliable and cheap for high-volume pipelines. Prefer it over retrying the LLM when the JSON is structurally close to valid and just needs cleanup.

## Known failure modes

- Input JSON is so severely corrupted that deterministic repair is impossible — returns error indicating irreparable input
- Missing required 'raw_json' query parameter — returns validation error
- Input is not JSON at all (e.g. plain prose) — may return error or attempt best-effort repair with low confidence
- Extremely long or deeply nested JSON may exceed processing limits

## How this service works

Repairs truncated or malformed LLM JSON outputs (trailing commas, markdown fences, single quotes) so multi-agent pipelines never crash. (Live x402 v2, IETF MPP & MCP endpoint at https://agentdiet.dev/v1/schema-repair)

## Output

A repaired, valid JSON object derived from the malformed input, with common LLM-output issues like trailing commas, markdown code fences, single quotes, and truncation corrected so downstream agents or parsers can safely consume it.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "required": [
  "raw_json"
 ],
 "properties": {
  "raw_json": {
   "type": "string",
   "minLength": 1,
   "description": "Malformed, truncated, or markdown-wrapped JSON string to deterministically repair"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "object"
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/agentdiet-schema-repair-ee0053f5/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from agentdiet.dev](https://www.zero.xyz/host/agentdiet.dev/llms.txt)
