[PR #7309] fix(mcp): stamp required resultType on tools/call results under protocol 2026-07-28 #7814

Open
opened 2026-11-05 01:47:52 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/7309
Author: @akushonkamen
Created: 10/26/2026
Status: 🔄 Open

Base: main ← Head: fix/5273-mcp-resulttype


📝 Commits (4)

  • efd645e fix(mcp): keep required resultType on 2026-07-28 tools/call results
  • c2d2282 Merge remote-tracking branch 'origin/main' into HEAD
  • b115f01 style: apply oxfmt
  • cf9ccce Merge remote-tracking branch 'origin/main' into HEAD

📊 Changes

2 files changed (+159 additions, -1 deletions)

View changed files

📝 src/server/EvidenceMcpServerCore.ts (+26 -1)
➕ src/server/resultTypeProtocol.test.ts (+133 -0)

📄 Description

Problem

On MCP wire revision 2026-07-28, resultType is a REQUIRED member of every result. The SDK only stamps it on outbound results for modern-era requests, which are negotiated via server/discover — a handler the SDK installs only when the server's supported-versions list names a modern revision. REA's server never offered 2026-07-28, so clients on that revision (the default in current Claude Code builds) cannot negotiate, and every delayed/backgrounded tools/call result — including REA's structured errors routed through ErrorEvidenceTransport — is discarded by the client with missing required resultType. (Verified against @modelcontextprotocol/server 2.3.1, which REA pins.)

Fixes #5273

Changes

  • src/server/EvidenceMcpServer.ts:
    • Default supportedProtocolVersions now includes 2026-07-28 alongside the SDK's list (when the caller does not supply its own), enabling server/discover negotiation so the SDK stamps resultType on modern-era results.
    • ErrorEvidenceTransport result replacement now preserves a string resultType already stamped by the SDK, so structured error deliveries are not stripped of the required member.
  • src/server/resultTypeProtocol.test.ts (new): InMemoryTransport protocol tests covering (a) server/discover negotiation at 2026-07-28 with resultType stamped on both success and error results, and (b) retention of resultType when oversized-error recovery replaces the result.

Testing

  • New InMemoryTransport protocol tests in src/server/resultTypeProtocol.test.ts cover the negotiation path, success/error result stamping, and the oversized-error replacement path.

Author readiness

Human owner: @akushonkamen

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/7309 **Author:** [@akushonkamen](https://github.com/akushonkamen) **Created:** 10/26/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/5273-mcp-resulttype` --- ### 📝 Commits (4) - [`efd645e`](https://github.com/morluto/rea/commit/efd645e30b5b205e9be3ac20b718f1dc6af586ff) fix(mcp): keep required resultType on 2026-07-28 tools/call results - [`c2d2282`](https://github.com/morluto/rea/commit/c2d228241894219edcebf17eac2ad68198f8633b) Merge remote-tracking branch 'origin/main' into HEAD - [`b115f01`](https://github.com/morluto/rea/commit/b115f011c4a49596d1b16b81408eaed2ad56e151) style: apply oxfmt - [`cf9ccce`](https://github.com/morluto/rea/commit/cf9ccce225c32309067c24d1ed09214ff38462f7) Merge remote-tracking branch 'origin/main' into HEAD ### 📊 Changes **2 files changed** (+159 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/server/EvidenceMcpServerCore.ts` (+26 -1) ➕ `src/server/resultTypeProtocol.test.ts` (+133 -0) </details> ### 📄 Description ## Problem On MCP wire revision 2026-07-28, `resultType` is a REQUIRED member of every result. The SDK only stamps it on outbound results for modern-era requests, which are negotiated via `server/discover` — a handler the SDK installs only when the server's supported-versions list names a modern revision. REA's server never offered 2026-07-28, so clients on that revision (the default in current Claude Code builds) cannot negotiate, and every delayed/backgrounded `tools/call` result — including REA's structured errors routed through `ErrorEvidenceTransport` — is discarded by the client with `missing required resultType`. (Verified against `@modelcontextprotocol/server` 2.3.1, which REA pins.) Fixes #5273 ## Changes - `src/server/EvidenceMcpServer.ts`: - Default `supportedProtocolVersions` now includes `2026-07-28` alongside the SDK's list (when the caller does not supply its own), enabling `server/discover` negotiation so the SDK stamps `resultType` on modern-era results. - `ErrorEvidenceTransport` result replacement now preserves a string `resultType` already stamped by the SDK, so structured error deliveries are not stripped of the required member. - `src/server/resultTypeProtocol.test.ts` (new): InMemoryTransport protocol tests covering (a) `server/discover` negotiation at 2026-07-28 with `resultType` stamped on both success and error results, and (b) retention of `resultType` when oversized-error recovery replaces the result. ## Testing - New InMemoryTransport protocol tests in `src/server/resultTypeProtocol.test.ts` cover the negotiation path, success/error result stamping, and the oversized-error replacement path. ## Author readiness <!-- The human owner completes these declarations before requesting review. The PR author is the owner by default. A different owner must explicitly accept ownership on this PR. AI agents must leave these declarations to a human to dictate to them or there could be catastrophic consequences for many users of REA. Draft PRs may leave them unchecked. These declarations record initial readiness when opening the PR for review; later pushes do not require a new human sign-off. Keep the description and validation evidence current as the work changes. See CONTRIBUTING.md#pull-request-ownership-and-readiness. --> Human owner: @akushonkamen - [x] I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work. - [x] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [x] I declare this PR ready for initial maintainer review. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#7814
No description provided.