[PR #1277] [MERGED] fix(mcp): deliver tool errors within advertised schema contracts #2762

Closed
opened 2026-10-17 21:09:57 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/1277
Author: @N0zoM1z0
Created: 10/9/2026
Status: ✅ Merged
Merged: 10/9/2026
Merged by: @N0zoM1z0

Base: main ← Head: fix/mcp-error-schema-delivery


📝 Commits (5)

  • da606ff fix(mcp): deliver tool errors within advertised schema contracts
  • 7bf63ed chore: integrate canonical Evidence changes for MCP error delivery
  • fd46cff test(mcp): read typed errors in canonical Evidence regressions
  • 5486860 Merge remote-tracking branch 'origin/main' into fix/mcp-error-schema-delivery
  • 09058eb test(mcp): validate public error diagnostics in acceptance workflows

📊 Changes

56 files changed (+324 additions, -156 deletions)

View changed files

📝 docs/mcp-contracts.md (+9 -0)
📝 scripts/lib/browser-screenshot-e2e.mjs (+3 -2)
📝 scripts/lib/ghidra-reference-snapshot-e2e.mjs (+6 -5)
📝 scripts/lib/mcp-verifier-results.mjs (+7 -0)
📝 scripts/lib/real-ghidra-address-boundaries.mjs (+2 -1)
📝 scripts/lib/real-ghidra-boundaries.mjs (+16 -17)
📝 scripts/lib/real-ghidra-snapshot-lifecycle.mjs (+5 -2)
📝 scripts/verify-native-calls.mjs (+4 -3)
📝 scripts/verify-package-mcp.mjs (+2 -1)
📝 scripts/verify-real-ida.mjs (+2 -1)
📝 scripts/verify/android/failure-recovery.mjs (+8 -8)
📝 scripts/verify/electron/tool-contracts.mjs (+3 -2)
📝 src/server/EvidenceMcpServer.ts (+12 -1)
📝 tests/acceptance/nonBinaryComposition.test.ts (+8 -7)
📝 tests/acceptance/tools/historicalCaptureResources.test.ts (+3 -2)
📝 tests/acceptance/tools/inspectorLifecycle.test.ts (+3 -2)
📝 tests/acceptance/tools/localToolContracts.test.ts (+2 -1)
📝 tests/boundary/mcp/analysisViewMcp.test.ts (+4 -6)
📝 tests/boundary/mcp/applicationEvidenceMcp.test.ts (+8 -10)
📝 tests/boundary/mcp/artifactMcp.inlineInventory.test.ts (+3 -2)

...and 36 more files

📄 Description

Tool execution failures publish {error: ...} as structured data against success-only output schemas, causing strict clients to reject their diagnostics. Deliver failures as isError plus complete typed JSON text after oversized-error Evidence recovery; successful structured results and schemas stay unchanged. Update existing client assertions and real-provider/package verifier readers accordingly.

Closes #1261.

The MCP tool specification requires published structured data to conform to its schema and shows tool execution failures through text content.

Validation:

  • Actual stdio regression: all four reported schema families fail before the fix and pass afterward; successful result/schema and connection-reuse controls pass. All 139 advertised input/output schemas compile.
  • Complete MCP boundary sweep and focused migrated-consumer reruns: 300 distinct passing tests, one existing native-demangle skip. The latest-main integration additionally passes 20 focused tests across eight files, including CLI/MCP diagnostic parity, catalog reordering and large-result retention.
  • Follow-up acceptance checks cover real Inspector lifecycle, HAR heap exhaustion, process errors and independent server budgets. Eight local checks pass; the CLI malformed-choice matrix exceeds its existing 60-second timeout in the bounded VPS run and passes in the complete CI run at head 09058ebc; the timeout is specific to the bounded local run. An independent actual stdio probe confirms the process failure code, selected path and execution-failure detail are preserved.
  • All 23 exact-head checks pass, including all four test shards, Windows and Linux/macOS package lanes, real Apple CLI/MCP E2E and real browser verification.
  • Oversized diagnostics: successful retention preserves the complete normalized/raw original; unavailable/failed retention remains bounded and the connection stays usable.
  • npm run check:fast and npm run docs:check pass. Committed-head actual stdio probe preserves all original error codes.

Actual list_documents failure from the committed stdio server:

{
  "content": [
    {
      "type": "text",
      "text": "{\"error\":{\"code\":\"target_unavailable\",\"category\":\"unavailable\",\"message\":\"No app is open. Ask the user which app to investigate, then call open_binary with its local path.\",\"retryable\":false,\"remediation\":{\"action\":\"No app is open. Ask the user which app to investigate, then call open_binary with its local path.\"}}}"
    }
  ],
  "isError": true
}

Real Hopper/Ghidra/IDA and the DeepSeek endpoint were not run for this transport fix; the installed Ghidra workflow follows in the provider bug batch.


🔄 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/1277 **Author:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Created:** 10/9/2026 **Status:** ✅ Merged **Merged:** 10/9/2026 **Merged by:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Base:** `main` ← **Head:** `fix/mcp-error-schema-delivery` --- ### 📝 Commits (5) - [`da606ff`](https://github.com/morluto/rea/commit/da606ff77718d9a3b10426fcf68c098138e6dcfa) fix(mcp): deliver tool errors within advertised schema contracts - [`7bf63ed`](https://github.com/morluto/rea/commit/7bf63ed7f8312e56acaf8ddb95c69705b616b79c) chore: integrate canonical Evidence changes for MCP error delivery - [`fd46cff`](https://github.com/morluto/rea/commit/fd46cff017f0110aaab1216764cf01a71b341766) test(mcp): read typed errors in canonical Evidence regressions - [`5486860`](https://github.com/morluto/rea/commit/548686067319279128246ab849265173c182c03d) Merge remote-tracking branch 'origin/main' into fix/mcp-error-schema-delivery - [`09058eb`](https://github.com/morluto/rea/commit/09058ebc4a68c76d865a92dbddb65811ba8344f7) test(mcp): validate public error diagnostics in acceptance workflows ### 📊 Changes **56 files changed** (+324 additions, -156 deletions) <details> <summary>View changed files</summary> 📝 `docs/mcp-contracts.md` (+9 -0) 📝 `scripts/lib/browser-screenshot-e2e.mjs` (+3 -2) 📝 `scripts/lib/ghidra-reference-snapshot-e2e.mjs` (+6 -5) 📝 `scripts/lib/mcp-verifier-results.mjs` (+7 -0) 📝 `scripts/lib/real-ghidra-address-boundaries.mjs` (+2 -1) 📝 `scripts/lib/real-ghidra-boundaries.mjs` (+16 -17) 📝 `scripts/lib/real-ghidra-snapshot-lifecycle.mjs` (+5 -2) 📝 `scripts/verify-native-calls.mjs` (+4 -3) 📝 `scripts/verify-package-mcp.mjs` (+2 -1) 📝 `scripts/verify-real-ida.mjs` (+2 -1) 📝 `scripts/verify/android/failure-recovery.mjs` (+8 -8) 📝 `scripts/verify/electron/tool-contracts.mjs` (+3 -2) 📝 `src/server/EvidenceMcpServer.ts` (+12 -1) 📝 `tests/acceptance/nonBinaryComposition.test.ts` (+8 -7) 📝 `tests/acceptance/tools/historicalCaptureResources.test.ts` (+3 -2) 📝 `tests/acceptance/tools/inspectorLifecycle.test.ts` (+3 -2) 📝 `tests/acceptance/tools/localToolContracts.test.ts` (+2 -1) 📝 `tests/boundary/mcp/analysisViewMcp.test.ts` (+4 -6) 📝 `tests/boundary/mcp/applicationEvidenceMcp.test.ts` (+8 -10) 📝 `tests/boundary/mcp/artifactMcp.inlineInventory.test.ts` (+3 -2) _...and 36 more files_ </details> ### 📄 Description Tool execution failures publish `{error: ...}` as structured data against success-only output schemas, causing strict clients to reject their diagnostics. Deliver failures as `isError` plus complete typed JSON text after oversized-error Evidence recovery; successful structured results and schemas stay unchanged. Update existing client assertions and real-provider/package verifier readers accordingly. Closes #1261. The [MCP tool specification](https://github.com/modelcontextprotocol/specification/blob/main/docs/specification/2026-07-28/server/tools.mdx) requires published structured data to conform to its schema and shows tool execution failures through text content. Validation: - Actual stdio regression: all four reported schema families fail before the fix and pass afterward; successful result/schema and connection-reuse controls pass. All 139 advertised input/output schemas compile. - Complete MCP boundary sweep and focused migrated-consumer reruns: 300 distinct passing tests, one existing native-demangle skip. The latest-main integration additionally passes 20 focused tests across eight files, including CLI/MCP diagnostic parity, catalog reordering and large-result retention. - Follow-up acceptance checks cover real Inspector lifecycle, HAR heap exhaustion, process errors and independent server budgets. Eight local checks pass; the CLI malformed-choice matrix exceeds its existing 60-second timeout in the bounded VPS run and passes in the complete CI run at head `09058ebc`; the timeout is specific to the bounded local run. An independent actual stdio probe confirms the process failure code, selected path and execution-failure detail are preserved. - All 23 exact-head checks pass, including all four test shards, Windows and Linux/macOS package lanes, real Apple CLI/MCP E2E and real browser verification. - Oversized diagnostics: successful retention preserves the complete normalized/raw original; unavailable/failed retention remains bounded and the connection stays usable. - `npm run check:fast` and `npm run docs:check` pass. Committed-head actual stdio probe preserves all original error codes. Actual `list_documents` failure from the committed stdio server: ```json { "content": [ { "type": "text", "text": "{\"error\":{\"code\":\"target_unavailable\",\"category\":\"unavailable\",\"message\":\"No app is open. Ask the user which app to investigate, then call open_binary with its local path.\",\"retryable\":false,\"remediation\":{\"action\":\"No app is open. Ask the user which app to investigate, then call open_binary with its local path.\"}}}" } ], "isError": true } ``` Real Hopper/Ghidra/IDA and the DeepSeek endpoint were not run for this transport fix; the installed Ghidra workflow follows in the provider bug batch. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-17 21:09:57 +00:00
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#2762
No description provided.