8000 Add support for grouping tools in MCP Python SDK · Issue #829 · modelcontextprotocol/python-sdk · GitHub
[go: up one dir, main page]

Skip to content
Add support for grouping tools in MCP Python SDK #829
Open
@Agent-Hellboy

Description

@Agent-Hellboy

Is your feature request related to a problem? Please describe.

HI , I was creating a mcp server for superset and find the use of tool grouping.
right now, every tool registered via @mcp.tool() is listed flat, there’s no way to organize or surface related tools together in the SDK or in UIs. As the number of tools grows, it becomes hard to discover and manage them.

Describe the solution you'd like
Extend the @mcp.tool() decorator (and underlying registration) to accept an optional group parameter. Store this on each Tool instance and include it in the metadata returned by list_tools(). For example:

@mcp.tool(group="dashboard")
def get_dashboard_data(a: int, b: int) -> int:
    pass 

@mcp.tool(group="chart")
def get_chart_data(a: str, b: str) -> str:
    pass 

Describe alternatives you've considered

  • Maintaining separate python modules or naming conventions to imply grouping†4C7A ”but this is brittle and pushes discovery responsibility onto users.

  • Building an external registry or YAML file mapping tools to categories, but this duplicates information and diverges from the code.

Additional context
You should be able to register the same tool under multiple groups.

I’d like to open a PR to add this capability, since I’m building an MCP server, implementing grouping will also deepen my understanding of the SDK

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0