Skip to content

Tools cannot be updated (suggested fix included) #176

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
samdoeswork opened this issue Mar 8, 2025 · 3 comments
Closed

Tools cannot be updated (suggested fix included) #176

samdoeswork opened this issue Mar 8, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@samdoeswork
Copy link

Describe the bug
The mcp.tool() method checks _registeredTools and errors if the tool has already been created. Unfortunately there is no method exposed to delete a tool. This means that a use case we have (a tool can change) cannot be supported.

To Reproduce
You could register a tool and then try to update it by re-registering, but also just look at the code above.

Expected behavior
This is half-way between bug and feature request - but I would like it to simply overwrite the tool.
Or to simply have a deleteToolIfExists() method.

Logs
If applicable, add logs to help explain your problem.

Additional context
Add any other context about the problem here.

@samdoeswork samdoeswork added the bug Something isn't working label Mar 8, 2025
@samdoeswork
Copy link
Author

Here's four ways to fix this (hence not doing a PR - you may have a preference & it's super trivial):

  1. Just delete this line as I think it does more harm than good (why not let us change our tools?)

if (this._registeredTools[name]) {
throw new Error(Tool ${name} is already registered);
}

  1. Same as above but with an option to decide whether this should be allowed

  2. Add a removeTool() method

  3. Remove the private flag on the class, so we can remove older definitions ourselves

@hamishll
Copy link

hamishll commented Apr 9, 2025

@samdoeswork did you find a workaround for this in the mean time? I've just run into this and it's a pretty big feature gap to not be able to remove or update tools!

@flintzPax8
Copy link

Looks like this is resolved in this merged PR.
#247

Eagerly awaiting it's release!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants