[PR #5913] feat(mcp): handle tools/list_changed notifications #11640

Closed
opened 2026-02-16 18:16:32 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/5913

State: closed
Merged: Yes


Summary

  • Subscribe to notifications/tools/list_changed from MCP servers
  • Publish mcp.tools.list_changed event to the internal bus when received
  • Enables consumers to react when servers dynamically modify their tool list

Context

MCP servers can dynamically add, remove, or modify tools at runtime. The official SDK provides ToolListChangedNotificationSchema for clients to subscribe to these changes, but opencode wasn't utilizing it.

Test plan

  • Connect to an MCP server that supports dynamic tools (you can use cargo install dictator (the tool will swap the tools once initalized from 1 -> 3 )
  • Verify notification handler is registered on connection
  • Trigger a tool list change on the server
  • Confirm mcp.tools.list_changed event is published to the bus
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/5913 **State:** closed **Merged:** Yes --- ## Summary - Subscribe to `notifications/tools/list_changed` from MCP servers - Publish `mcp.tools.list_changed` event to the internal bus when received - Enables consumers to react when servers dynamically modify their tool list ## Context MCP servers can dynamically add, remove, or modify tools at runtime. The official SDK provides `ToolListChangedNotificationSchema` for clients to subscribe to these changes, but opencode wasn't utilizing it. ## Test plan - [x] Connect to an MCP server that supports dynamic tools (you can use `cargo install dictator` (the tool will swap the tools once initalized from 1 -> 3 ) - [x] Verify notification handler is registered on connection - [x] Trigger a tool list change on the server - [x] Confirm `mcp.tools.list_changed` event is published to the bus
yindo added the pull-request label 2026-02-16 18:16:32 -05:00
yindo closed this issue 2026-02-16 18:16:32 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#11640