Title: MCPServer: ctx.notify_tools_changed() is a silent no-op on handshake-era (2025-11-25) connections, and tools.listChanged is advertised as false · Issue #3862 · modelcontextprotocol/python-sdk · GitHub
Open Graph Title: MCPServer: ctx.notify_tools_changed() is a silent no-op on handshake-era (2025-11-25) connections, and tools.listChanged is advertised as false · Issue #3862 · modelcontextprotocol/python-sdk
X Title: MCPServer: ctx.notify_tools_changed() is a silent no-op on handshake-era (2025-11-25) connections, and tools.listChanged is advertised as false · Issue #3862 · modelcontextprotocol/python-sdk
Description: Summary On a connection opened with the initialize handshake (2025-11-25 and earlier), MCPServer has two problems: It advertises tools: {listChanged: false}, even though add_tool() / remove_tool() change the list at runtime. MCPServer.ru...
Open Graph Description: Summary On a connection opened with the initialize handshake (2025-11-25 and earlier), MCPServer has two problems: It advertises tools: {listChanged: false}, even though add_tool() / remove_tool() ...
X Description: Summary On a connection opened with the initialize handshake (2025-11-25 and earlier), MCPServer has two problems: It advertises tools: {listChanged: false}, even though add_tool() / remove_tool() ...
Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/issues/3862
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"MCPServer: ctx.notify_tools_changed() is a silent no-op on handshake-era (2025-11-25) connections, and tools.listChanged is advertised as false","articleBody":"### Summary\n\nOn a connection opened with the `initialize` handshake (2025-11-25 and earlier), `MCPServer` has two problems:\n\n1. It advertises `tools: {listChanged: false}`, even though `add_tool()` / `remove_tool()` change the list at runtime. `MCPServer.run()` gives no public way to pass `NotificationOptions(tools_changed=True)`.\n2. `Context.notify_tools_changed()` publishes only to the `subscriptions/listen` bus. A handshake-era client gets nothing, and there is no error or warning. `notify_prompts_changed()` and `notify_resources_changed()` probably behave the same way (not tested).\n\nThe 2026-07-28 path works. So a server written against the documented API updates its tool list for modern clients and silently never does for handshake clients.\n\n### Why it matters now\n\nGoose 1.57.0 negotiates 2026-07-28 but never opens `subscriptions/listen` (aaif-goose/goose#13055). The only way to get a tool-list change to Goose today is the 2025-11-25 era, and this bug drops it there. The Goose side works: with the workaround below, Goose lists and calls a tool added mid-turn.\n\nWorkaround we use: `await ctx.request_context.session.send_tool_list_changed()`, plus serving with `create_initialization_options(NotificationOptions(tools_changed=True))`.\n\n### Reproduction (mcp 2.3.0, Python 3.14)\n\nBoth tests fail. Replacing `ctx.notify_tools_changed()` with `ctx.request_context.session.send_tool_list_changed()` makes the second pass, which shows the client side is fine.\n\n```python\nimport anyio\nimport mcp_types as types\nimport pytest\n\nfrom mcp.client.client import Client\nfrom mcp.server.mcpserver import Context, MCPServer\n\npytestmark = pytest.mark.anyio\n\n\ndef _server() -> MCPServer:\n server = MCPServer(\"listchanged-handshake\")\n\n def late_tool() -> str:\n \"\"\"Registered at runtime.\"\"\"\n return \"late\"\n\n @server.tool()\n async def enable(ctx: Context) -> str:\n \"\"\"Register late_tool and announce it with the public Context API.\"\"\"\n server.add_tool(late_tool)\n await ctx.notify_tools_changed()\n return \"enabled\"\n\n return server\n\n\nasync def test_handshake_client_is_told_tools_list_changed_is_supported() -> None:\n \"\"\"A server that can change its tools says so to a 2025-11-25 client.\"\"\"\n async with Client(_server(), mode=\"legacy\") as client:\n assert client.protocol_version == \"2025-11-25\"\n tools = client.server_capabilities.tools\n assert tools is not None and tools.list_changed is True # fails: False\n\n\nasync def test_notify_tools_changed_reaches_handshake_client() -> None:\n \"\"\"ctx.notify_tools_changed() sends tools/list_changed to a 2025-11-25 client.\"\"\"\n received = anyio.Event()\n\n async def on_message(message: object) -> None:\n if isinstance(message, types.ToolListChangedNotification):\n received.set()\n\n async with Client(_server(), mode=\"legacy\", message_handler=on_message) as client:\n await client.call_tool(\"enable\", {})\n with anyio.move_on_after(1):\n await received.wait()\n assert received.is_set(), \"notify_tools_changed() sent nothing\" # fails\n assert \"late_tool\" in {tool.name for tool in (await client.list_tools()).tools}\n```\n\n### Expected\n\nOn handshake-era connections:\n\n- Advertise `listChanged: true` for tools, or at least make it configurable from `MCPServer`.\n- Have `notify_*_changed()` send `notifications/*/list_changed` on the session. That era has no subscription filter, and a server that declared `listChanged` may send these notifications.\n\n### Related\n\n- #1429: send the notification automatically on `add_tool()` / `remove_tool()`. Older than the era split.\n- #1486: `NotificationOptions` for FastMCP (stale).\n- #3851: the era is latched by the first request.\n- aaif-goose/goose#13055\n\n---\n\n_Generated by [Claude Code](https://claude.ai/code)_\n","author":{"url":"https://github.com/dcode","@type":"Person","name":"dcode"},"datePublished":"2026-11-14T17:17:34Z","url":"https://github.com/modelcontextprotocol/python-sdk/issues/3862"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:dd3d6fe7-1a04-63d1-4b50-536dfdd78db1 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B596:1FFF:DCAF22:13016ED:6B056552 |
| html-safe-nonce | d15555424547403092d272b4b5e172c6555104c6c0e6c79e73fd45ed9493c3e0 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNTk2OjFGRkY6RENBRjIyOjEzMDE2RUQ6NkIwNTY1NTIiLCJ2aXNpdG9yX2lkIjoiNDgzNDczMjc2MDA1NDk4MTk3MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 7947c6cd3c4bb3b607e9337e3b4e82cb0131d1fae85e251c35d1bb539a0a2853 |
| hovercard-subject-tag | issue:6393431727 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/modelcontextprotocol/python-sdk/3862/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0a054ec66985645273a9435f17e723a7a02d1b8f4591c0116df1fe7ef823c96a/modelcontextprotocol/python-sdk/issues/3862 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0a054ec66985645273a9435f17e723a7a02d1b8f4591c0116df1fe7ef823c96a/modelcontextprotocol/python-sdk/issues/3862 |
| og:image:alt | Summary On a connection opened with the initialize handshake (2025-11-25 and earlier), MCPServer has two problems: It advertises tools: {listChanged: false}, even though add_tool() / remove_tool() ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dcode |
| hostname | github.com |
| expected-hostname | github.com |
| None | 1be5cc09efdd4833c24a4ffa71d698e3999fa09071e159fe14c2c08e41c98331 |
| turbo-cache-control | no-preview |
| go-import | github.com/modelcontextprotocol/python-sdk git https://github.com/modelcontextprotocol/python-sdk.git |
| octolytics-dimension-user_id | 182288589 |
| octolytics-dimension-user_login | modelcontextprotocol |
| octolytics-dimension-repository_id | 862584018 |
| octolytics-dimension-repository_nwo | modelcontextprotocol/python-sdk |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 862584018 |
| octolytics-dimension-repository_network_root_nwo | modelcontextprotocol/python-sdk |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | f6d69234e682c947a48074340e69d45d5901de31 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width