# x402broker Schema Repair

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

Deterministically repairs truncated or malformed LLM-generated JSON (trailing commas, markdown fences, single quotes) and validates it against a schema so multi-agent pipelines don't crash.

## Facts

- Endpoint: GET https://x402broker.com/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/x402broker-schema-repair-942b8ac6
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_27lPee9ixYUv0orFPO2uC

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 x402broker-schema-repair-942b8ac6
```

Example prompt: The LLM just returned this broken JSON with trailing commas and markdown code fences — can you repair and validate it so the pipeline doesn't crash: ```{\"name\": \"Alice\", \"score\": 42,}```?

## When to prefer this

Choose this endpoint when your multi-agent pipeline receives LLM-generated JSON that fails standard JSON.parse due to common LLM formatting artifacts: trailing commas, markdown code fences, single-quote delimiters, or truncation. It is purpose-built for A2A (agent-to-agent) reliability use cases, is deterministic (not probabilistic), and is cheaper per-call than using another LLM to reformat the output. Prefer it over writing custom regex fixers or calling a general-purpose LLM for cleanup.

## Known failure modes

- Input JSON too severely malformed to recover — returns error indicating unrecoverable structure
- Input string is not JSON-like at all — returns validation error
- Schema mismatch after repair — repaired JSON is syntactically valid but does not conform to provided schema
- Empty or missing raw_json query parameter — returns 400-level error
- Network timeout or service unavailability — returns 5xx error

## 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://x402broker.com/v1/schema-repair)

## Output

Returns a cleaned, repaired JSON object with invalid syntax corrected — trailing commas removed, markdown fences stripped, single quotes normalized to double quotes, and truncation handled — along with a validation result indicating whether the output conforms to the expected schema.

## 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/x402broker-schema-repair-942b8ac6/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402broker.com](https://www.zero.xyz/host/x402broker.com/llms.txt)
