Skip to content

fix(mcp): return structured compact results#1043

Merged
DeusData merged 2 commits into
DeusData:mainfrom
WarGloom:agent/fix-mcp-structured-content
Jul 16, 2026
Merged

fix(mcp): return structured compact results#1043
DeusData merged 2 commits into
DeusData:mainfrom
WarGloom:agent/fix-mcp-structured-content

Conversation

@WarGloom

Copy link
Copy Markdown
Contributor

What does this PR do?

Every MCP tool advertises an object outputSchema, but compact TOON and
plain-text results omitted structuredContent. Strict MCP clients therefore
rejected otherwise successful tool calls with -32600.

This change keeps JSON-object results unchanged and adds an object for every
other result:

  • successful text and TOON payloads use {"text":"..."}
  • error text uses {"error":"..."}

The existing text content block remains for model visibility and backwards
compatibility.

Validation

  • ASAN_OPTIONS=detect_leaks=0 make -f Makefile.cbm test — 6,009 passed,
    1 skipped
  • make -f Makefile.cbm lint-ci
  • wire-level coverage for compact search_graph responses plus unit coverage
    for plain-text and error results

Checklist

  • Every commit is signed off (git commit -s) — required, CI rejects
    unsigned commits (DCO, see CONTRIBUTING.md)
  • Tests pass locally (make -f Makefile.cbm test)
  • Lint passes (make -f Makefile.cbm lint-ci)
  • New behavior is covered by a test (reproduce-first for bug fixes)

WarGloom added 2 commits July 12, 2026 13:55
Tools advertise an object outputSchema, so strict MCP clients reject compact TOON responses that omit structuredContent.

Signed-off-by: wargloom <wargloom@gmail.com>
@WarGloom WarGloom marked this pull request as ready for review July 12, 2026 18:24
@WarGloom WarGloom requested a review from DeusData as a code owner July 12, 2026 18:24
@DeusData DeusData added the bug Something isn't working label Jul 14, 2026
@DeusData DeusData added this to the 0.9.1-rc milestone Jul 14, 2026
@DeusData DeusData added editor/integration Editor compatibility and CLI integration priority/normal Standard review queue; useful PR with ordinary maintainer urgency. labels Jul 14, 2026
@DeusData

Copy link
Copy Markdown
Owner

Thanks for the compact structured-result fix. This is a normal-priority 0.9.1-rc MCP compatibility bug. Review will verify the JSON-RPC structuredContent contract, content fallback behavior for older clients, error responses, and that compact mode does not silently change existing tool payload semantics.

@DeusData DeusData merged commit 91d1a23 into DeusData:main Jul 16, 2026
20 checks passed
@DeusData

Copy link
Copy Markdown
Owner

Merged. This closes a real protocol-compliance gap in the TOON compact-output work (#1013): every MCP tool advertises an object outputSchema, but the compact-TOON and plain-text result paths omitted structuredContent, so strict clients rejected otherwise-successful calls with -32600. Verified: the three assertions are genuine guards (RED without your change — structuredContent absent — GREEN with it), the value is a proper {"text": ...} object (no double-encoding), JSON-object results are unchanged, mcp suite 165/165, lint clean. Thank you — good catch on the strict-client rejection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working editor/integration Editor compatibility and CLI integration priority/normal Standard review queue; useful PR with ordinary maintainer urgency.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants