Skip to content

removing a tool or resource dynamically #711

Description

@skunkwerk

Is your feature request related to a problem? Please describe.
There doesn't seem to be a way to call remove_tool or remove_resource, such as in the tool manager

Describe the solution you'd like
If this is indeed the case, I'm happy to submit a PR to add those methods to the resource & tool managers in fastMCP

Describe alternatives you've considered
None

Activity

  1. davila7 commented on May 16, 2025

    @davila7

    Hi @skunkwerk,

    I've submitted a PR that addresses this feature request: #728

    The PR adds enable() and disable() methods to tools, which allows temporarily disabling tools and re-enabling them when needed.

    Would this solution work for your use case?

  2. lukehsiao commented on Sep 19, 2025

    @lukehsiao

    The PR adds enable() and disable() methods to tools, which allows temporarily disabling tools and re-enabling them when needed.

    Would this solution work for your use case?

    I can't speak for @skunkwerk, but for our use case (a multi-tenant MCP server), no, we need to actually remove the tool, not just disable it.

    Right now, we are doing some hackery like

        def _remove_tool_from_mcp(self, tool_name: str) -> bool:
            """Remove a tool from the MCP server.
    
            NOTE: There is no API available for tool removal, so we edit private members ourselves.
            """
            if tool_name in mcp._tool_manager._tools:  # noqa: SLF001
                del mcp._tool_manager._tools[tool_name]  # noqa: SLF001
                return True
            return False
  3. added
    enhancementRequest for a new feature that's not currently supported
    ready for workEnough information for someone to start working on
    P2Moderate issues affecting some users, edge cases, potentially valuable feature
    on Oct 3, 2025
  4. linked a pull request that will close this issuefeat: add ability to remove tools #1322on Oct 3, 2025
  5. felixweinberger commented on Oct 3, 2025

    @felixweinberger
    Contributor

    Should be addressed by #1322 once we land that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Moderate issues affecting some users, edge cases, potentially valuable featureenhancementRequest for a new feature that's not currently supportedready for workEnough information for someone to start working on

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions