Skip to content

Commit df31a06

Browse files
committed
Add missing TasksCallCapability to enable proper MCP task support
The enable_tasks() method was creating TasksToolsCapability without the required nested call capability. This caused VS Code Copilot and other MCP clients to fail their capability detection check (tasks?.requests?.tools?.call !== undefined), silently falling back to synchronous tool calls instead of using the proper asynchronous MCP Tasks protocol. This fix: - Imports TasksCallCapability from mcp.types - Passes call=TasksCallCapability() when creating TasksToolsCapability - Adds unit test to verify the nested capability is properly set Without this fix, long-running tools would timeout after 5 minutes instead of receiving proper asynchronous task handling. Github-Issue: #1853
1 parent 0da9a07 commit df31a06

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/mcp/server/lowlevel/experimental.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
ServerResult,
3232
ServerTasksCapability,
3333
ServerTasksRequestsCapability,
34+
TasksCallCapability,
3435
TasksCancelCapability,
3536
TasksListCapability,
3637
TasksToolsCapability,
@@ -79,7 +80,7 @@ def update_capabilities(self, capabilities: ServerCapabilities) -> None:
7980
capabilities.tasks.cancel = TasksCancelCapability()
8081

8182
capabilities.tasks.requests = ServerTasksRequestsCapability(
82-
tools=TasksToolsCapability()
83+
tools=TasksToolsCapability(call=TasksCallCapability())
8384
) # assuming always supported for now
8485

8586
def enable_tasks(

tests/experimental/tasks/server/test_run_task_flow.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,10 @@ async def test_enable_tasks_auto_registers_handlers() -> None:
227227
assert caps_after.tasks is not None
228228
assert caps_after.tasks.list is not None
229229
assert caps_after.tasks.cancel is not None
230+
# Verify nested call capability is present
231+
assert caps_after.tasks.requests is not None
232+
assert caps_after.tasks.requests.tools is not None
233+
assert caps_after.tasks.requests.tools.call is not None
230234

231235

232236
@pytest.mark.anyio

0 commit comments

Comments
 (0)