Skip to content

feat: enhance dynamic tool management with notifications and enable/disable #1429

Description

@maxisbey

Summary

Enhance the Python SDK's dynamic tool management capabilities to match the TypeScript SDK by adding:

  1. Automatic tools/list_changed notifications when tools are added/removed
  2. Tool enable/disable functionality (temporary hiding without removal)

Background

The Python SDK currently supports adding and removing tools dynamically (see #1322), but lacks two key features present in the TypeScript SDK:

1. List Changed Notifications

The TypeScript SDK automatically sends notifications/tools/list_changed when tools are modified. This allows clients to know when they should refresh their tool list.

Python SDK gap: Currently, when calling add_tool() or remove_tool(), clients are not notified of the change and may show stale tool lists.

2. Enable/Disable Tools

The TypeScript SDK provides enable() and disable() methods on tools:

const tool = server.tool("myTool", ..., async () => { ... });
tool.disable()  // Hides from list_tools, blocks calls
tool.enable()   // Re-enables the tool
tool.remove()   // Permanently removes

Benefits:

  • Temporarily hide tools without losing registration
  • Re-enable tools without re-registering
  • Useful for permission-based or state-based tool visibility

Python SDK gap: Only permanent removal via remove_tool() is supported. No way to temporarily disable/re-enable tools.

References

Activity

  1. added
    enhancementRequest for a new feature that's not currently supported
    on Oct 6, 2025
  2. maxisbey commented on Oct 6, 2025

    @maxisbey
    ContributorAuthor

    I'm not entirely sure how this should be implemented. The Typescript SDK returns an object which can be used for removing/enabling/disabling, but I'm not sure this exact thing would work well for Python given that we use decorators for registering tools. Keen to hear other's thoughts.

  3. added
    ready for workEnough information for someone to start working on
    P2Moderate issues affecting some users, edge cases, potentially valuable feature
    v2Affects the v2 line (2.x on main)
    on Oct 6, 2025
  4. beaterblank commented on Oct 9, 2025

    @beaterblank

    We could add enable_tool(self, name) and disable_tool(self, name) methods within the FastMCP class, which interfaces with the tool manager. These methods could use the existing

    def get_tool(self, name: str) -> Tool | None:
    """Get tool by name."""
    return self._tools.get(name)

    function to retrieve the tool instance, and enable or disable it. Each tool instance would include an is_enabled attribute that can be checked before the tool is executed. From there, we could send a notification via the context manager. we should also maybe do this with resources.

  5. added
    P1Significant bug affecting many users, highly requested feature
    and removed
    P2Moderate issues affecting some users, edge cases, potentially valuable feature
    on Oct 9, 2025
  6. kuku929 commented on Dec 17, 2025

    @kuku929

    Is there a way to have dynamic tool management? A hacky method should also suffice my use case. But I do think that this is an important feature the SDK should support.

  7. kuku929 commented on Dec 18, 2025

    @kuku929

    Found a way around this for now:

    async def tool_list_update(ctx : Context, names : List[str]) -> List[str]:
        """
        inject the context and use the send_tool_list_changed() to inform client
        """
        for name in names:
            if name in dynamic_toolset:
                mcp.add_tool(dynamic_toolset[name], name = name)
        await ctx.session.send_tool_list_changed() # send the notification
        return ret
  8. added
    needs decisionIssue is actionable, needs maintainer decision on whether to implement
    and removed
    ready for workEnough information for someone to start working on
    on Apr 17, 2026
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

    P1Significant bug affecting many users, highly requested featureenhancementRequest for a new feature that's not currently supportedneeds decisionIssue is actionable, needs maintainer decision on whether to implementv2Affects the v2 line (2.x on main)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions