modelcontextprotocol / modelcontextprotocol/go-sdk

Proposal: support for sending `tools/list_changed` notifications manually

Open
#666 17 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs investigation
Dominant language
Go
Stars
5.1k
Forks
543
Avg merge
1d 17h
Merged PRs (30d)
37

Description

Is your feature request related to a problem? Please describe.
At the moment in this library it seems to only be possible to send a tools/list_changed notifications when one of two events are triggered: AddTools and RemoveTools. In the GitHub MCP Server we would like to extend this so that these notifications can be sent when other conditions occur such as a mismatch in the version of the MCP server in a session and the client. At this point in time, this does not seem to be possible.

Describe the solution you'd like
For context, we create a new mcp.Server instance per request, since each user may have different tools depending on factors such as their license, the client the token was minted for, if they are a staff user, or if they have a feature toggled on. Because we construct a server for each request, we never add new tools to a server, they are simply there before the server is started.

That being said, we do need a way of notifying clients that new tools are available when they are released. We're looking at doing this via this notification when the available tools differ from what is stored in their session (which is handled outside the scope of the MCP server's internal sessions.)

Describe alternatives you've considered

  1. Forcing tool registration changes: We considered artificially adding/removing a dummy tool to trigger the notification, but this is hacky and pollutes the tool list unnecessarily.

  2. We've also looked at intercepting requests and return a 400, invalidating a MCP session and theoretically having the client reinitialise their connection thereby getting a new tool list. In practice this is not well supported, while this works in VSCode for example, in Claude Code it results in a persistent broken connections until the agent runtime is restarted.

cc @omgitsads

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how AddTools and RemoveTools trigger tools/list_changed notifications in the Go SDK. Identify the server notification path and determine how a caller could request the same notification when tools were registered before the server started. Done means callers can manually send the notification without adding or removing a dummy tool, with behavior covered by the relevant tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.