π The fast, Pythonic way to build MCP servers and clients.
Feat(client): add cancel notification method
davenpi2a65c0848e88
diff --git a/src/fastmcp/client/client.py b/src/fastmcp/client/client.pyindex 19552ea35..f6333fb08 100644--- a/src/fastmcp/client/client.py+++ b/src/fastmcp/client/client.py@@ -210,6 +210,23 @@ class Client:result = await self.session.send_ping()return isinstance(result, mcp.types.EmptyResult)+ async def cancel(+ self,+ request_id: str | int,+ reason: str | None = None,+ ) -> None:+ """Send a cancellation notification for an in-progress request."""+ notification = mcp.types.ClientNotification(+ mcp.types.CancelledNotification(+ method="notifications/cancelled",+ params=mcp.types.CancelledNotificationParams(+ requestId=request_id,+ reason=reason,+ ),+ )+ )+ await self.session.send_notification(notification)+async def progress(self,progress_token: str | int,