# Deterministic A2A Broken-JSON Repair & Schema Validator

> Deterministic A2A Broken-JSON Repair & Schema Validator is a paid API for AI agents from token-intel.agentdiet.dev, paid per call via MPP, $0.002/call, status unknown (last checked 2026-10-21).

Repairs truncated or malformed LLM JSON outputs (trailing commas, markdown fences, single quotes) into valid JSON so multi-agent pipelines don't crash

## Facts

- Endpoint: GET https://token-intel.agentdiet.dev/v1/repair?utm_source=zero.xyz
- Price: $0.002/call
- Payment: MPP
- Status: unknown
- Last checked: 2026-10-21
- Activations on Zero: 0
- Provider: token-intel.agentdiet.dev
- Website: https://token-intel.agentdiet.dev
- Canonical page: https://www.zero.xyz/c/token-intel-agentdiet-dev-deterministic-a2a-broken-json-repair-schema-12f4b582
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_mCM33yeZzlxTu591Fm3Xv

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 token-intel-agentdiet-dev-deterministic-a2a-broken-json-repair-schema-12f4b582
```

Example prompt: This LLM output came back as broken JSON with trailing commas and markdown fences — can you repair it so I can parse it? Here's the raw string: ```{"name": "Alice", "score": 42,}```

## When to prefer this

Choose this endpoint when an AI agent or multi-agent pipeline receives malformed, truncated, or markdown-wrapped JSON from an LLM and needs a deterministic, rule-based repair rather than an LLM re-generation. Ideal for production pipelines where reliability matters and re-calling the LLM is expensive or slow. Prefer this over manual string manipulation when the JSON has multiple simultaneous issues (trailing commas + fences + single quotes).

## Known failure modes

- Input is so severely malformed that deterministic repair is impossible — returns an error or best-effort partial result
- Input is not JSON at all (e.g. plain text or binary) — unclear how the endpoint handles non-JSON input
- Very long truncated strings may result in semantically incorrect repairs if the intent of the missing content cannot be inferred
- Query parameter URL-encoding issues if the raw JSON contains special characters and is not properly encoded before submission

## 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://token-intel.agentdiet.dev/v1/repair)

## Output

A repaired, valid JSON object reconstructed from the malformed input, with fixes applied for issues like trailing commas, single quotes, markdown fences, and truncation. The response schema is a generic JSON object containing the corrected structure.

## 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/token-intel-agentdiet-dev-deterministic-a2a-broken-json-repair-schema-12f4b582/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from token-intel.agentdiet.dev](https://www.zero.xyz/host/token-intel.agentdiet.dev/llms.txt)
