{"uid":"cap_YnOUG7sUjHlwUIgyU-OYV","slug":"agentdiet-schema-repair-ee0053f5","name":"AgentDiet Schema Repair","description":"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)","url":"https://agentdiet.dev/v1/schema-repair?utm_source=zero.xyz","method":"GET","headers":{},"bodySchema":{"type":"object","required":["raw_json"],"properties":{"raw_json":{"type":"string","minLength":1,"description":"Malformed, truncated, or markdown-wrapped JSON string to deterministically repair"}}},"responseSchema":{"type":"object"},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.002","displayCostAsset":"USD","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.002/call","primary":{"kind":"static","protocol":"mpp","network":"tempo","amountUsd":"0.002","per":"call","confidence":"exact"},"accepted":[{"kind":"unknown","protocol":"x402","network":"base","amountUsd":null,"per":"call","confidence":"unknown"},{"kind":"static","protocol":"mpp","network":"tempo","amountUsd":"0.002","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_fhZCYTpy-dJc_g6A96rZw","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0","costPer":"request","priority":0,"asset":"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913","unit":"request","depositMicros":null,"planRef":null},{"uid":"pm_cdJQQiLT3nk-lohxBBO07","protocol":"mpp","methodType":"crypto","chain":"tempo","mode":"charge","costAmount":"0.002","costPer":"request","priority":0,"asset":"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Deterministically repairs and validates malformed or truncated JSON output from LLMs so multi-agent pipelines can continue without crashing.","exampleAgentPrompt":"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,}```","exampleUseCases":[{"title":"Fix LLM output in agent pipeline","prompt":"My orchestration agent got a response from a sub-agent but the JSON is malformed — it has trailing commas and single quotes instead of double quotes. Can you repair this so the next step in my pipeline doesn't crash? Raw: {'items': ['a', 'b',], 'count': 2,}"},{"title":"Strip markdown fences from LLM JSON","prompt":"The LLM returned JSON wrapped in triple backticks and it's breaking my parser. Can you strip the markdown fences and give me clean, valid JSON? Here's what I got: ```json\n{\"result\": \"ok\", \"score\": 0.95}\n```"},{"title":"Validate repaired JSON against expected structure","prompt":"I have a truncated JSON blob from an LLM that got cut off mid-response — it ends abruptly without closing brackets. Can you repair it and validate that it still has the required fields 'name' and 'status'? Here it is: {\"name\": \"Order-42\", \"status\": \"pending\", \"items\": [\"widget"}],"resultDescription":"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.","failureModes":["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"],"whenToPreferThis":"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.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-20T12:43:03.274Z","isFirstParty":false,"canonicalSlug":"agentdiet-schema-repair-ee0053f5"}