Skip to content

Conversation

@seuros
Copy link
Contributor

@seuros seuros commented Dec 21, 2025

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

@rekram1-node
Copy link
Collaborator

/review

@rekram1-node
Copy link
Collaborator

okay cool, ty! I appreciate u looking into mcp support have a few other prs to merge in too so we can be more up to date w spec

@github-actions
Copy link
Contributor

lgtm

@seuros
Copy link
Contributor Author

seuros commented Dec 21, 2025

Take your time!

The refresh is working now.

@rekram1-node
Copy link
Collaborator

ill take a look at this tonight, will test but at a glance it lgtm

@seuros seuros force-pushed the feat/mcp-tool-list-changed-notification branch from 30943fc to 6b0746b Compare December 21, 2025 20:55
Subscribe to MCP server notifications for tool list changes and publish
events to the internal bus. This allows consumers to refresh their tool
cache when servers dynamically add, remove, or modify tools.
@seuros seuros force-pushed the feat/mcp-tool-list-changed-notification branch from 6b0746b to 850af90 Compare December 21, 2025 23:33
@rekram1-node
Copy link
Collaborator

Okay so this publishes an event but what's the purpose? Just opencode sdk stuff? Or just tryign to make sure we both understand what this will do

@seuros
Copy link
Contributor Author

seuros commented Dec 22, 2025

The IDE (the client) listen to the notification and follow the spec.

If you install the mcp with cargo and mount it.

  • You will have 1 tool, because your repo is not configured.
  • The Tool is called, it get configured.
  • Opencode receive notification , and it refresh it tools automatically.

Previously you had to stop the session and reset opencode respawrn the new tools.

I wrote a small Article, currently Charm and VScode support the spec. If this PR get merged opencode will too.

The MCP i shared is just a linter and you can install it from source.

@rekram1-node rekram1-node force-pushed the feat/mcp-tool-list-changed-notification branch from a3c5381 to 4f1fb32 Compare December 24, 2025 01:35
@rekram1-node rekram1-node merged commit f4d61be into anomalyco:dev Dec 24, 2025
2 checks passed
@seuros seuros deleted the feat/mcp-tool-list-changed-notification branch December 25, 2025 14:26
rekram1-node added a commit that referenced this pull request Dec 27, 2025
Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com>
Co-authored-by: Aiden Cline <aidenpcline@gmail.com>
anntnzrb pushed a commit to anntnzrb/opencode-1 that referenced this pull request Dec 29, 2025
Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com>
Co-authored-by: Aiden Cline <aidenpcline@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants