Skip to content

Conversation

chipgpt
Copy link

@chipgpt chipgpt commented Oct 2, 2025

Motivation and Context

Currently the only way to manage a tool from the server is by having a reference to the tool and using methods like tool.disable(). This adds new methods to the server to manage a tool by name server.disableTool('name').

If we like this idea, I can also do the same for resources, resource templates, and prompts.

How Has This Been Tested?

Tests were added to address the existing tool methods and also the new server methods.

Breaking Changes

No breaking changes.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

@chipgpt chipgpt requested review from a team and ihrpr October 2, 2025 16:49
@chipgpt
Copy link
Author

chipgpt commented Oct 2, 2025

Thinking about this more, would it make sense to do a more generic method like server.getTool('name')? This way you could enable/disable/remove/update tools without having a reference to the tool.

@chipgpt
Copy link
Author

chipgpt commented Oct 4, 2025

Thinking about this more, would it make sense to do a more generic method like server.getTool('name')? This way you could enable/disable/remove/update tools without having a reference to the tool.

I tried this approach and found myself having to do this a lot:

const tool = server.getTool('name');
if (tool) {
  tool.disable();
}
...
const tool = server.getTool('name');
if (tool) {
  tool.enable();
}

I think it would be much nicer to use server.disableTool('name'), server.enableTool('name'), etc. instead

@chipgpt chipgpt requested a review from a team as a code owner October 5, 2025 18:49
@chipgpt chipgpt changed the title feature: Add server.removeTool('name') feature: Add tool management to McpServer instance Oct 5, 2025
@chipgpt chipgpt force-pushed the feature/server-remove-tool branch from 72c2065 to 49cab34 Compare October 5, 2025 21:07
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.

1 participant