Repository navigation
test(integration): support deferred MCP tool calls in SDK E2E - #12365
Conversation
Local verification — real CLI build + real MCP server, scripted modelI built the E2E environment locally and ran Worth flagging up front: this PR comes from a fork, so Rig
Only the model is substituted — everything the assertions read (SDK transcript, bridge resolution, permission path, MCP execution) is the real product code. ResultArm A's failure text is identical to main CI run 35545401904 — same 7 tests, same messages, including the The failures really were falseA probe through the same CLI and SDK, printing what the transcript carries: The MCP tool ran and returned Three wire shapes × two armsThe top row is the positive control the PR description promises: with the pre-#10410 top-level name, both arms stay green, so the patch adds recognition of the envelope without dropping the direct form. Cross-checks
Non-blocking observations
Reprogit worktree add --detach /tmp/wt origin/main && cd /tmp/wt && pnpm install # prepare builds dist/cli.js
# start a local OpenAI-compatible server that answers the suite's prompts with
# tool_search{query:"select:mcp__test-math-server__add"} then
# tool_call{name:"mcp__test-math-server__add",arguments:{a,b}}
QWEN_HOME=<clean home with security.auth.selectedType=openai> \
OPENAI_API_KEY=fake-key OPENAI_BASE_URL=<server>/v1 OPENAI_MODEL=fake-model QWEN_MODEL=fake-model \
NO_PROXY=127.0.0.1,localhost QWEN_SANDBOX=false \
pnpm exec vitest run --root ./integration-tests --retry=0 \
--poolOptions.forks.minForks 1 --poolOptions.forks.maxForks 1 \
sdk-typescript/mcp-server.test.ts
# arm A (main's mcp-server.test.ts): 7 failed | 2 passed
# arm B (this PR's file, same build): 9 passed中文说明本地验证 —— 真实 CLI 构建 + 真实 MCP 服务器 + 脚本化模型我在本地搭了 E2E 环境,对 先说一件与合并决策直接相关的事:本 PR 来自 fork, 装置
只有模型被替换;断言真正读到的东西(SDK transcript、桥接解析、权限链路、MCP 执行)全部是真实产品代码。 结果上方第一张图:Arm A(main)7 failed / 2 passed,Arm B(本 PR)9 passed。Arm A 的失败文本与 main CI run 35545401904 完全一致 —— 同样的 7 个用例、同样的消息,包括 这些失败确实是误报第二张图是用同一套 CLI 与 SDK 做的探针输出:MCP 工具确实执行了,返回 三种 wire 形态 × 两臂第三张图给出完整矩阵。第一行是 PR 描述承诺的阳性对照:用 #10410 之前的顶层工具名时两臂都绿,说明补丁是在不丢掉直接形态的前提下新增了对信封形态的识别。 交叉检查
非阻塞观察
|




What this PR does
Update the MCP SDK integration assertions to recognize deferred MCP invocations represented by the stable tool_call bridge envelope, while continuing to accept direct MCP tool-use blocks.
Why it's needed
After #10410, deferred MCP tools are invoked through tool_call with the target tool name in the input payload. The existing integration assertions still looked only for the legacy top-level MCP tool name, so the main E2E job reports seven false failures in #12357 even though the bridge executes the tools successfully.
Reviewer Test Plan
How to verify
Run the MCP SDK integration E2E with a configured model. Exercise add, multiply, chained calls, repeated calls, multi-turn calls, permission callbacks, and message-flow assertions. The calls should be recognized for both the direct form and the tool_call bridge form, and all seven failures from #12357 should pass.
Evidence (Before & After)
N/A — no user-visible change; this PR updates E2E assertions only.
Tested on
Environment (optional)
Node 24.15.0, pnpm 11.24.0, Windows. Prettier, ESLint, and integration TypeScript checks passed. A related fake-model SDK MCP bridge run passed 3 of 4 cases; the remaining error-handling case exited with Windows status 3221226505.
Risk & Scope
Linked Issues
Fixes #12357
中文说明
本 PR 做了什么
更新 MCP SDK 集成测试断言,使其识别由稳定的 tool_call 桥接信封表示的延迟 MCP 调用,同时继续兼容直接的 MCP 工具调用块。
为什么需要它
在 #10410 之后,延迟 MCP 工具通过 tool_call 调用,目标工具名位于输入载荷中。现有集成测试断言只查找旧的顶层 MCP 工具名,因此主分支 E2E 作业在 #12357 中报告了七个误失败,尽管桥接实际能够成功执行工具。
审查者测试计划
如何验证
在已配置模型的环境中运行 MCP SDK 集成 E2E。覆盖 add、multiply、链式调用、重复调用、多轮调用、权限回调和消息流断言。对于直接形式和 tool_call 桥接形式,都应能识别调用,并且 #12357 中的七个失败应全部通过。
证据(前后对比)
不适用——没有用户可见变化;本 PR 只更新 E2E 断言。
测试平台
环境(可选)
Node 24.15.0、pnpm 11.24.0、Windows。Prettier、ESLint 和集成测试 TypeScript 检查均通过。相关的 fake-model SDK MCP 桥接运行通过 4 个用例中的 3 个;剩余的错误处理用例以 Windows 状态码 3221226505 退出。
风险与范围
关联 Issue
Fixes #12357