Something went wrong. Try again.
mirror of github.com/PrefectHQ/fastmcp
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041"""Advertisement of the SEP-2663 tasks extension capability.
A server with the tasks extension registered advertises the`io.modelcontextprotocol/tasks` extension in its capabilities; a server withoutit does not."""
from __future__ import annotations
from fastmcp import FastMCPfrom fastmcp.client import Clientfrom fastmcp.utilities.tasks import TASKS_EXTENSION_IDfrom fastmcp_tasks import TasksExtension
async def test_extension_capability_advertised(): """The tasks extension is advertised when registered.""" mcp = FastMCP("capability-test") mcp.add_extension(TasksExtension())
@mcp.tool(task=True) async def my_tool() -> str: return "ok"
async with Client(mcp, mode="auto") as client: extensions = client.server_capabilities.extensions or {} assert extensions.get(TASKS_EXTENSION_ID) == {}
async def test_extension_capability_absent_without_extension(): """The tasks extension is not advertised when no extension is registered.""" mcp = FastMCP("capability-test")
@mcp.tool async def my_tool() -> str: return "ok"
async with Client(mcp, mode="auto") as client: extensions = client.server_capabilities.extensions or {} assert TASKS_EXTENSION_ID not in extensions