feat(mcp)!: return text-only tool results by default; add mcp --structured

Merged
TH
5d ago
+576-227

Summary

Default agent-device mcp returns compact text without output schemas or structuredContent, so clients do not replace that text with the larger JSON result. Errors use the shared CLI renderer, preserving dispatch disclosure, observe-first advice and diagnostic paths. ADR 0012 records the revised contract and rationale.

  • agent-device mcp --structured restores output schemas and structured results.
  • AI SDK data tools retain structured results and schemas.
  • mcpOutputFormat: "json", non-default responseLevel, and includeCost retain their JSON-text opt-ins.

42 files. Includes the #4458 output-schema guard adjustment; no new command family.

Validation

Current head: 5a5995e9adf2525a20e25e107e729077778f001a. Validation: CI. Hosted checks are green; Apex Sentinel approves with no findings. All review threads are resolved. Maintainer sign-off remains pending.

At a4bc1e6: frozen install/build and 227 MCP/AI SDK tests pass. Two new error regressions fail before the fix and pass afterward. Its exact affected gate failed at production-exports (run-FstHFp, clean checkout); prior stages passed. At 5a5995e9, the repaired production-exports guard passes locally and in hosted CI. CI tested merge checkout 8fbce857d8 (this head plus main e54dc4d8).

Review evidence: corrected error fixture sizes are 212โ†’143 and 235โ†’166 bytes. Earlier measurements belong to their earlier SHAs. The prior headless-client run did not capture a settled press success. No device-facing behavior changed in this review fix.

๐Ÿค– Generated with Claude Code


Autofix with [code]smith
Open in [code]smith ยท Need help on this PR? Tag @codesmith-bot with what you need.