modelcontextprotocol / modelcontextprotocol/go-sdk
Proposal: provide a Server.SetTools method
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 5.1k
- Forks
- 543
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 37
Description
Description
The design document clearly states that one of the differences between the official SDK and Mark3Labs mcp-go is that only Server.AddTools is provided and that the rest of Tool-management functions are deemed unnecessary:
There are also some comments in the code regarding the batch notification of tool changes:
Problem
The AddTool logic allows for an upsert (adding or replacing) of a tool based on the name.
However, this seems insufficient when we want to completely replace the list of available tools.
The problems are mainly two:
- The additional pressure on the client for each tool addition (a new notification is sent for each).
- The requirement to track the tools that have been exposed in the server in case we no longer want to expose one of them.
In the Kubernetes MCP Server we require this functionality to be able to replace the complete tool list that is exposed to the client, which at some point be more more restricted.
This forces us to first remove all the tools and then add them again.
Alternatives
At the moment we've implemented the workaround in our repository by tracking the tools and doing the removal and then the addition:
This works, but if others find it useful I think it might be better to provide the feature in the SDK itself.
Additional Context
I actually created the original SetTools method in the mcp-go repository, the reasoning exposed in the PR is the same for this feature request:
https://github.com/mark3labs/mcp-go/pull/24
Kubernetes MCP Server related issues and PRs:
- https://github.com/containers/kubernetes-mcp-server/pull/385
- https://github.com/containers/kubernetes-mcp-server/issues/219
If you're interested on this feature I can work on its implementation.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read design/design.md at the tool-management section and mcp/server.go around the tool-change notification comments. Compare the existing AddTool behavior with the workaround in pkg/mcp/mcp.go from the linked Kubernetes MCP Server. Done means the SDK can replace the exposed tool list without requiring callers to track and remove tools individually.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100