Skip to content

Commit a88a687

Browse files
committed
docs: type cancellable tool snippet
1 parent 2424438 commit a88a687

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

README.v2.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2187,9 +2187,10 @@ already owns the original request ID.
21872187
For long-running work that a client needs to cancel, prefer the experimental task API when the server supports it:
21882188

21892189
```python
2190+
from mcp import ClientSession
21902191
from mcp.types import CallToolResult
21912192

2192-
async def cancel_long_running_tool(session):
2193+
async def cancel_long_running_tool(session: ClientSession) -> CallToolResult:
21932194
# Start the tool as a task instead of blocking on call_tool().
21942195
task_result = await session.experimental.call_tool_as_task(
21952196
"long_running_tool",

0 commit comments

Comments
 (0)