# 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-23).

Repairs truncated or malformed LLM JSON outputs (trailing commas, markdown fences, single quotes, truncation) so multi-agent pipelines never crash on bad JSON.

## Facts

- Endpoint: POST https://token-intel.agentdiet.dev/v1/repair?utm_source=zero.xyz
- Price: $0.002/call
- Payment: MPP
- Status: unknown
- Last checked: 2026-10-23
- 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-b12b9074
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_jGeVT-jTBbQgD5GGczxco

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-b12b9074 -d '<json body>'
```

Example prompt: The LLM returned this broken JSON with trailing commas and markdown fences — can you run it through the JSON repair service to get a clean, parseable object? Here it is: ```json {"name": "Alice", "score": 42, } ```

## When to prefer this

Choose this endpoint when you need deterministic, rule-based JSON repair rather than probabilistic LLM-based fixing. Ideal for multi-agent pipelines where reliability and idempotency matter, especially when LLM outputs frequently contain trailing commas, markdown fences, or single quotes. Prefer this over writing custom regex or using an LLM to fix JSON, as it is cheap ($0.002/call), fast, and supports idempotency keys for safe retries.

## Known failure modes

- Input is so severely malformed that deterministic repair is impossible — returns an error response
- Input is not JSON-like at all (e.g., plain prose) — cannot repair
- Truncation is too severe to infer missing structure — may return partial or error
- Network timeout or service unavailability — 5xx response
- Missing required raw_json field — 4xx validation 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://token-intel.agentdiet.dev/v1/repair)

## Output

Returns a repaired, valid JSON object that was previously malformed, truncated, or wrapped in markdown. The response is a JSON object containing the cleaned and validated output, ready for downstream consumption by agents or services.

## 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-b12b9074/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)
