fix(gateway): preserve structured tool results - #206
Conversation
2c20375 to
8f420c5
Compare
|
@claude review this PR |
|
Claude finished @its-mash's task in 1m 51s —— View job Review: preserve structured tool results
SummaryThis is a well-scoped fix. The root cause analysis is correct: Things that look good
Minor / non-blocking observations
None of these block the fix — the core bug (structured content and Branch: |
Planning doc for the API-key inbound auth / id-type binding / Space lock port from upstream PR series mcpmux#201-mcpmux#206, executed across Phases 1-4. Signed-off-by: crimsonsunset <jsangio1@gmail.com>
…liation Merges upstream mcpmux/mcp-mux main (through mcpmux#215) into dev-rebased. Resolves conflicts between upstream's original mcpmux#201/mcpmux#202/mcpmux#203/mcpmux#205/mcpmux#206 implementations and this fork's own reconciled port (Phases 1-4 of upstream-client-mapping-reconciliation.md) by keeping the fork's version wherever the two implement the same feature: - Migrations: kept 036-038 (fork numbering/shape); removed upstream's 020_inbound_client_api_keys.sql / 021_binding_type.sql / 022_inbound_client_locked_space.sql as superseded (Decision 6 — one reconciled migration set, not a straight append) - Resolver, repositories, domain, Tauri commands, Clients/Workspaces UI: kept the fork's Unbound-preserving, Tier 0/2 implementation over upstream's SpaceDefault-based one (Decisions 1/2) - navigation.ts / HomePage.tsx: kept the fork's nav (Decision 5 — no Apps->Clients / Workspaces->Mapping rename); HomePage.tsx stays deleted (already removed by the fork's earlier Dashboard-unification commit, unrelated to this merge) - Took upstream's unrelated CI hardening (apt cache pinning, Claude Code Actions workflow) and its new API-key e2e test as-is Autonomous decisions: - Fixed tests/rust/tests/database/migrations.rs upgrade-path regression test to reference migration 036/037/038 (not upstream's 020/021/022) and drop the partial indexes migration 037 creates before dropping the binding_type column, or the rollback step fails - Fixed 3 e2e specs asserting upstream's rejected nav rename ('Mapping') to assert the fork's real label ('Projects') instead Signed-off-by: crimsonsunset <jsangio1@gmail.com>
Summary
Preserve
structuredContentand protocol-level_metawhen forwarding downstreamtools/callresults through the gateway.Problem
A downstream server can advertise an
outputSchemaand correctly return both textcontentandstructuredContent. The gateway previously reduced that response to onlycontentplusisErrorwhile routing it, then constructed a newCallToolResultfrom those two fields.Strict MCP clients consequently rejected otherwise successful tool calls with an error like:
This is not specific to one downstream implementation: it affects any tool that advertises an output schema and returns structured output.
Root cause
The result was narrowed at two gateway boundaries:
RoutingServiceconverted the downstreamCallToolResultinto a customToolCallResultcontaining onlycontentandis_error.Both transformations discarded
structured_content; protocol-levelmetawas discarded for the same reason.Fix
structured_contentandmetathroughToolCallResult.CallToolResultso both routing boundaries preserve the same fields.No downstream server changes are required.
Verification
cargo +1.88.0 fmt --all -- --checkcargo +1.88.0 test -p mcpmux-gateway— 145 passed, 0 failedcargo +1.88.0 build --release -p mcpmuxcontentandstructuredContentand pass client-side output validation.Scope
The patch is limited to the gateway result-conversion path and one regression test. It does not change downstream servers, tool schemas, permissions, or feature-set routing.