-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Description
Description
The MCP spec (2025-11-25) requires tools to declare task support via execution.taskSupport in the tools/list response:
In the result of tools/list, tools declare support for tasks via
execution.taskSupport, which if present can have a value of "required", "optional", or "forbidden".
While server.experimental.enable_tasks() correctly handles server-level capabilities and task handler registration, there is no way to set execution.taskSupport on individual tools through the high-level API.
Current behavior
MCPServer.add_tool() (and the internal Tool model in mcp/server/mcpserver/tools/base.py) does not accept an execution parameter. Tools registered via add_tool() will always have execution: null in the tools/list response, which per spec means taskSupport defaults to "forbidden".
This means even when enable_tasks() is called and the server declares tasks.requests.tools.call capability, clients like the MCP Inspector see taskSupport as "forbidden" and disable the "Run as task" option.
Expected behavior
MCPServer.add_tool() should accept an optional execution parameter (of type ToolExecution) so developers can declare taskSupport per tool:
from mcp.types import ToolExecution, TASK_OPTIONAL
mcp.add_tool(
my_handler,
name="long_running_tool",
description="A tool that takes a while",
execution=ToolExecution(taskSupport=TASK_OPTIONAL),
)Workaround
Currently the only workaround is to monkey-patch the tools/list handler to inject execution.taskSupport into the response:
server = mcp._lowlevel_server
original = server._request_handlers.get("tools/list")
async def patched(ctx, params):
result = await original(ctx, params)
for tool in result.tools:
tool.execution = ToolExecution(taskSupport=TASK_OPTIONAL)
return result
server._request_handlers["tools/list"] = patchedAffected files
src/mcp/server/mcpserver/tools/base.py—Toolmodel andTool.from_function()missingexecutionfieldsrc/mcp/server/mcpserver/tools/tool_manager.py—ToolManager.add_tool()missingexecutionparametersrc/mcp/server/mcpserver/server.py—MCPServer.add_tool()missingexecutionparameter