Add TaskConfig for SEP-1686 execution modes

Expose the full MCP task execution modes (forbidden/optional/required)
via TaskConfig instead of just boolean task=True/False.
This commit is contained in:
Jeremiah Lowin 2025-12-06 21:01:11 -05:00
commit a231ea4c3c
19 changed files with 854 additions and 263 deletions

View file

@ -222,7 +222,7 @@ async def test_tool_functionality_with_annotations():
async def test_task_execution_auto_populated_for_task_enabled_tool():
"""Test that execution.task is automatically set when tool has task=True."""
"""Test that execution.taskSupport is automatically set when tool has task=True."""
mcp = FastMCP("Test Server")
@mcp.tool(task=True)
@ -235,7 +235,7 @@ async def test_task_execution_auto_populated_for_task_enabled_tool():
assert len(tools_result) == 1
assert tools_result[0].name == "background_tool"
assert tools_result[0].execution is not None
assert tools_result[0].execution.task == "optional"
assert tools_result[0].execution.taskSupport == "optional" # type: ignore[attr-defined]
async def test_task_execution_omitted_for_task_disabled_tool():