Skip to content

Tools built from functools.partial are named 'partial' and overwrite each other #5266

Closed

Description

@BlueX888

What happened?

Tools created from a functools.partial get the name partial (the functools.partial class name) instead of the wrapped function's name, and their description becomes the functools.partial class docstring. Registering two partial-based tools therefore collides on the name partial and the second tool replaces the first (with only a generic "Component already exists" warning).

Expected: each tool takes the wrapped function's name and docstring, as it does when the same function is registered directly.

Example Code

import asyncio
import functools

from fastmcp import Client, FastMCP


def multiply(x: int, y: int) -> int:
    """Multiply two numbers."""
    return x * y


def greet(name: str) -> str:
    """Greet a person."""
    return f"Hello, {name}!"


mcp = FastMCP()
mcp.add_tool(functools.partial(multiply, y=2))
mcp.add_tool(functools.partial(greet))


async def main():
    async with Client(mcp) as client:
        for tool in await client.list_tools():
            print(tool.name, "--", tool.description)


asyncio.run(main())

This prints a single tool named partial with the description partial(func, *args, **keywords) - new function with partial application of the given arguments and keywords. — multiply is gone.

Version Information

FastMCP version: 4.0.10.dev2+edc991e4 (current main)
MCP version: 2.0.0
Python version: 3.12.14
Platform: macOS-26.6-arm64-arm-64bit

Activity

  1. added
    bugSomething isn't working. Reports of errors, unexpected behavior, or broken functionality.
    on Sep 25, 2026
  2. added a commit that references this issue on Oct 5, 2026
    949fea4
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

    bugSomething isn't working. Reports of errors, unexpected behavior, or broken functionality.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions