python-sdk icon indicating copy to clipboard operation
python-sdk copied to clipboard

Task capability not configured at the server level when expected

Open LucaButBoring opened this issue 9 months ago • 8 comments

Initial Checks

  • [x] I confirm that I'm using the latest version of MCP Python SDK
  • [x] I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening this issue

Description

The enable_tasks() method doesn't properly set the tasks.requests.tools.call capability on the server, causing compatibility issues with clients that assert against server capabilities before attempting task support on a tool invocation.

Identified during https://github.com/strands-agents/sdk-python/pull/1475.

Example Code


Python & MCP Python SDK

Python 3.12.9
MCP SDK 1.25.0

LucaButBoring avatar Feb 04 '26 21:02 LucaButBoring

Have a potential fix, putting up pr

adityuhkapoor avatar Feb 11 '26 05:02 adityuhkapoor

This was fixed in #1854 (merged Jan 15) — the TasksToolsCapability() was missing the call=TasksCallCapability() argument in update_capabilities().

Before the fix:

capabilities.tasks.requests = ServerTasksRequestsCapability(
    tools=TasksToolsCapability()  # call was None
)

After #1854:

capabilities.tasks.requests = ServerTasksRequestsCapability(
    tools=TasksToolsCapability(call=TasksCallCapability())
)

This should be available in SDK versions > 1.25.0. Can this issue be closed?

BabyChrist666 avatar Feb 22 '26 05:02 BabyChrist666

This is still a problem, was that reverted? Relevant code is here.

LucaButBoring avatar Feb 23 '26 21:02 LucaButBoring

@LucaButBoring The fix is present on main and was included in v1.26.0 (released Jan 24). The line you linked (experimental.py:L81) shows:

capabilities.tasks.requests = ServerTasksRequestsCapability(
    tools=TasksToolsCapability(call=TasksCallCapability())
)

That call=TasksCallCapability() argument is the fix from #1854. Before the fix it was just TasksToolsCapability() with no call.

Are you maybe running an older SDK version? Check with pip show mcp — you need >= 1.26.0.

BabyChrist666 avatar Feb 24 '26 18:02 BabyChrist666

It looks fixed on main, but I am on 1.26.0 - this is the line from the commit at which that was released from: https://github.com/modelcontextprotocol/python-sdk/blob/3d9d34552a9ab8988acf8d06e4a705bd799fc32b/src/mcp/server/lowlevel/experimental.py#L82

LucaButBoring avatar Feb 24 '26 19:02 LucaButBoring

You're absolutely right, apologies for the incorrect info! I double-checked:

  • PR #1854 was merged to main on Jan 15
  • v1.26.0 was tagged on Jan 24 from the v1.x branch

The fix commit (b26e5b9) is on main but was never backported to v1.x, so it's not in any release yet.

# v1.26.0 (v1.x branch) — still has the bug:
tools=TasksToolsCapability()

# main — has the fix:
tools=TasksToolsCapability(call=TasksCallCapability())

This needs a backport to v1.x to ship in the next release. I can open a cherry-pick PR if the maintainers would like.

BabyChrist666 avatar Feb 24 '26 19:02 BabyChrist666

Opened #2137 to backport the fix to v1.x so it ships in the next release.

BabyChrist666 avatar Feb 24 '26 19:02 BabyChrist666

Fixed in #1854 (main) and #2137 (v1.x backport).

maxisbey avatar Mar 06 '26 10:03 maxisbey