Skip to content

[Bug] Tool transforms silently strip task_config/execution from task-enabled tools #5780

Closed

Description

@BlueX888

Summary

Any tool transform that goes through Tool.from_tool() — i.e. both Tool.from_tool(...) directly and mcp.add_transform(ToolTransform({...})) (whose ToolTransformConfig.apply() calls it) — silently strips background-task support from task-enabled tools. A tool registered with task=True that is renamed or rewrapped by a transform comes out with TaskConfig(mode="forbidden") and execution=None, so:

  1. The wire tool no longer advertises task execution (to_mcp_tool().execution is None), so an opted-in client can never get a CreateTaskResult for it.
  2. The tasks extension interceptor (fastmcp_tasks/extension.py) checks tool.task_config.supports_tasks() before tasking a call, so the transformed tool always runs in the foreground.
  3. get_tasks() / Docket registration (fastmcp_slim/fastmcp/server/providers/base.py, _apply_task_transforms) filters on c.task_config.supports_tasks() after applying the provider's transforms, so the renamed task tool silently disappears from task registration even though it remains callable.

Repro

import asyncio

from fastmcp import FastMCP
from fastmcp.server.transforms import ToolTransform
from fastmcp.tools import Tool
from fastmcp.tools.tool_transform import ToolTransformConfig


async def slow(x: int) -> int:
    return x


async def main() -> None:
    # Minimal path: Tool.from_tool
    tool = Tool.from_function(slow, task=True)
    transformed = Tool.from_tool(tool, name="slow_v2")

    print("parent      mode:", tool.task_config.mode)
    print("transformed mode:", transformed.task_config.mode)
    print("parent      execution:", tool.to_mcp_tool().execution)
    print("transformed execution:", transformed.to_mcp_tool().execution)

    # Server-level path: ToolTransform + get_tasks
    mcp = FastMCP("repro")
    mcp.add_transform(ToolTransform({"slow": ToolTransformConfig(name="slow_v2")}))
    mcp.add_tool(Tool.from_function(slow, task=True))
    print("get_tasks():", [c.name for c in await mcp.get_tasks()])


asyncio.run(main())

Output on current main (commit fb52bd3):

parent      mode: optional
transformed mode: forbidden
parent      execution: task_support='optional'
transformed execution: None
get_tasks(): []

Expected: a pure rename preserves the parent's task capability — mode='optional', execution=task_support='optional', and get_tasks() == ['slow_v2'].

Root cause

TransformedTool.from_tool (fastmcp_slim/fastmcp/tools/tool_transform.py, the cls(...) call around line 611) threads name, version, title, description, parameters, output_schema, tags, annotations, meta and auth from the parent — but not task_config or execution. The FastMCPComponent default TaskConfig(mode="forbidden") then applies.

The mounting path already does the right thing: FastMCPProviderTool.wrap (fastmcp_slim/fastmcp/server/providers/fastmcp_provider.py:72-73) passes task_config=tool.task_config, execution=tool.execution, so a task-enabled tool mounted from a child server keeps task support. Transforms are the only path that loses it.

Evidence / fix

  • Reproduced on main at commit fb52bd3 (v4.1.1.dev5); the snippet above is exactly what it prints there.
  • Threading the two missing fields in from_tool's cls(...) call — adding task_config=tool.task_config, execution=tool.execution, mirroring FastMCPProviderTool.wrap — makes the repro print optional / task_support='optional' / ['slow_v2']. Two focused unit tests (transformed tool supports_tasks() and to_mcp_tool().execution is not None) go red on main and green with that change.
  • With the fix, the surrounding suites all pass: tests/tools/, tests/tasks/, tests/server/transforms/, and tests/server/.
  • I have this minimal fix plus the regression tests ready and am happy to open a PR.

Related

#5687 (transformed tools lose their icons) is the same family — fields not threaded through TransformedTool.from_tool — but distinct fields; this issue covers the task_config/execution loss.

Activity

  1. added
    bugSomething isn't working. Reports of errors, unexpected behavior, or broken functionality.
    serverRelated to FastMCP server implementation or server-side functionality.
    on Oct 17, 2026
  2. added a commit that references this issue on Oct 18, 2026
    1548e9f
  3. added a commit that references this issue on Nov 10, 2026
    b4c48a2
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.serverRelated to FastMCP server implementation or server-side functionality.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions