Repository navigation
fix(server): preserve explicit tool listChanged capability - #2625
LizunovSergey wants to merge 3 commits into
Conversation
🦋 Changeset detectedLatest commit: c879eb4 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
15cf0fa to
0ef1663
Compare
|
Exact head I added a wire-level test in a detached worktree. The PR's two capability tests pass for both Zod versions (4 passed). The new test is 2 failed (Zod v3/v4): after The write at Please gate the public helper on the declared tools |
3176d34 to
c879eb4
Compare
|
Confirmed: on
|
|
On exact head
Please gate that underlying public path as well, or otherwise prevent it from contradicting the handshake. I made no production change; the disposable test is removed and the worktree is clean. |
Summary
tools.listChanged: falsevalue when the first tool is registeredMcpServercan merge its default without overwriting caller configurationlistChanged: truedefault when no value is providednotifications/tools/list_changedinMcpServer.sendToolListChanged()when the declaredtools.listChangedisfalse, so registration, update and removal do not send the notification the server advertises as unsupportedRoot cause
McpServer.setToolRequestHandlers()unconditionally registeredtools.listChanged: true, and the capability merge allowed that internal default to overwrite the constructor-provided value. The v2 server already reads the current capability before applying the default; this brings the same tool behavior tov1.x.Closes #2622.
Validation
npx vitest run test/server/mcp.test.ts(252 passed, including a wire-level test thattools.listChanged: falsesends no notification, in both Zod variants)npm run typechecknpm run lintAI assistance disclosure: Codex was used to help investigate and implement this change. I reviewed the diff and validated the code and tests locally.