Skip to main content
Glama

recover_agent_output

Recover and validate broken structured output from LLMs and AI agents. Extract JSON hidden in prose or Markdown, repair malformed JSON, enforce a supplied JSON Schema, safely coerce optional types/defaults, report exact validation errors, and return a deterministic retry prompt when output still fails. Useful for tool calls, agent workflows, automation pipelines, and API integrations. Price: $0.01 USDC. An unpaid call returns an x402 PaymentRequired tool result and does not run the tool. Payment is verified and settled before the tool runs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
schemaNoOptional JSON Schema Draft 2020-12 used to validate the recovered value.
optionsNo
rawOutputYesRaw LLM or AI-agent output. Prose, Markdown fences, and malformed JSON are accepted.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.9/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden and does well: it discloses the $0.01 USDC price, that an unpaid call returns an x402 PaymentRequired result and does not execute, and that payment is verified and settled before the tool runs. It also states the deterministic retry-prompt behavior on persistent failure. It stops short of describing the successful return shape or any limits beyond the schema's maxLength.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Purpose is front-loaded, followed by a compact capability list, use cases, and the payment terms. Every sentence is substantive, though the 'useful for...' list is generic filler that could be trimmed.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with no annotations, no output schema, and nested parameters, the description covers the operation set, failure path, and payment behavior. It is nearly complete; the main gap is that the successful return value (recovered data plus validation status) is only implied, not described.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 67%, so the schema documents most parameters. The description reinforces the 'schema' parameter (enforcing a supplied JSON Schema) and the coercion/default options, but it never mentions 'removeAdditional' or adds syntax/format detail beyond the schema. This is the expected baseline when the schema does most of the work.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb+resource ('Recover and validate broken structured output from LLMs and AI agents') and then enumerates the concrete operations: extracting JSON from prose/Markdown, repairing malformed JSON, enforcing a schema, coercing types, reporting validation errors, and generating a retry prompt. This is unambiguous and self-distinguishing, even though the siblings (research/catalog tools) are unrelated domains.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It offers usage contexts ('tool calls, agent workflows, automation pipelines, and API integrations'), which are essentially universal and provide no real selection criteria. There is no when-not-to-use guidance and no named alternative, so usage is only implied rather than explicitly framed.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources