AI agents are notoriously gullible. If a tool returns JSON that matches the shape but not the substance, the agent will happily act on garbage data. A recent investigation into the Quarkus MCP Server revealed that while schemas were defined, the actual results were never validated against them. The fix, merged on November 6, changes the default behavior to fail loudly rather than log quietly, closing a critical gap in the Model Context Protocol (MCP) implementation.

The Silent Schema Mismatch

The core issue lay in the disconnect between schema generation and result serialization. In the Quarkus MCP Server, the output schema was generated from Java return types, while the JSON response was written by a different library. This allowed discrepancies to pass unnoticed. For example, a tool might promise a numeric 'amount' field but return the string "12.50", or rename 'currency' to 'currency_code'. The agent, expecting a specific structure, received mismatched data and proceeded without error, treating the invalid input as valid.

Fail-Closed by Default

Ravi Prakash Meena, the contributor behind the fix, initially opened an issue to highlight the gap. After verifying that TypeScript, Python, and Java MCP SDKs all enforced strict validation, the design decision was made to align Quarkus with this standard. The new default setting is 'fail', which returns a specific tool errorβ€”such as 'Output validation error: Invalid structured content'β€”instead of passing bad data to the agent. A configuration option, quarkus.mcp.server.schema-validator.tool-output, allows teams to switch to 'log' or 'off' during transition periods, but the breaking change is explicitly noted in release notes to ensure visibility.

Validating the Validator

The investigation didn't stop at the MCP server. Meena also audited the underlying JSON Schema validator, networknt's json-schema-validator, used by his library Outputgate. The validator failed specific hostname tests in the official JSON Schema suite, incorrectly accepting international domain names (IDNs) that didn't conform to current standards. By generating approximately 460,000 Unicode labels and comparing them against a Python reference library, seven hidden bugs were exposed. The fix, merged on November 7, enforces strict length limits and proper IDN decoding, proving that even trusted validation libraries require rigorous, large-scale testing.

Key Takeaways

  • Trust No Output: Agents cannot inherently verify data integrity; validation must happen at the tool boundary before the agent acts.
  • Fail Loudly: Silent logging is insufficient for critical data paths. Defaulting to hard failures prevents 'garbage in, garbage out' scenarios.
  • Audit Dependencies: Even widely used validators like networknt's can have edge-case failures. Reference-based testing at scale is essential.
  • Breaking Changes Matter: Stricter validation may reject previously accepted data, requiring clear communication to users.

The Bottom Line

Your agent is only as smart as the data you feed it. If your tools aren't strictly validating their outputs against their schemas, you're building on quicksand. Stop trusting the JSON blob and start checking the checker.