Skip to content
reaatechREAATECH

reaatech/structured-output-repair

0Last commit: Jun 4, 2026GitHub →

These packages give you a repair engine that takes a Zod schema and malformed LLM output, then runs it through six graduated strategies—stripping markdown fences, extracting JSON from prose, fixing syntax errors, coercing types, fuzzy-matching keys, and removing extra fields—to return valid, schema-conforming data instead of crashing. You'd adopt them to handle the common failure modes of LLM structured output generation: trailing commas, truncated streams, Python literals, hallucinated field names, and JSON buried in conversational wrappers. The most distinctive thing is the graduated pipeline approach—each strategy runs in sequence, the engine validates after each step, and it returns as soon as the data conforms, giving you detailed diagnostics including per-field errors and best-effort partial data when full repair fails.

Packages

2 packages

@reaatech/structured-repair-core

v1.0.0
A Zod schema–driven repair engine that applies six graduated strategies (prose extraction, truncation repair, type coercion, fuzzy key matching, extra field removal, and input analysis) to malformed LLM outputs, returning schema-conforming data or detailed failure metadata. Exports `repair`, `repairOutput`, `isValid`, and `analyzeInput` functions, and requires `zod` as a peer dependency.
status
published
published
12 days ago

@reaatech/structured-repair-mcp

v1.0.0
An MCP server that exposes `structured.repair` and `structured.analyze` as tools, letting MCP-compatible clients (Claude Desktop, Cursor) repair malformed LLM structured outputs against a JSON Schema.
status
published
published
12 days ago

Comments

Sign in with GitHub to comment and vote.

Loading comments…