Skip to content

Commit 6c79b83

Browse files
committed
feat: add CancelledNotification type
- Add CancelledNotification class for handling cancelled requests - Add CancelledNotification to ClientNotification union type - Improve type safety for cancelled notifications
1 parent e592afd commit 6c79b83

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/mcp/types.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -975,6 +975,15 @@ class RootsListChangedNotification(Notification):
975975
params: NotificationParams | None = None
976976

977977

978+
class CancelledNotification(Notification):
979+
"""
980+
A notification sent when a request is cancelled.
981+
"""
982+
method: Literal["notifications/cancelled"]
983+
params: NotificationParams | None = None
984+
985+
986+
978987
class ClientRequest(
979988
RootModel[
980989
PingRequest
@@ -997,7 +1006,8 @@ class ClientRequest(
9971006

9981007
class ClientNotification(
9991008
RootModel[
1000-
ProgressNotification | InitializedNotification | RootsListChangedNotification
1009+
ProgressNotification | InitializedNotification |
1010+
RootsListChangedNotification | CancelledNotification
10011011
]
10021012
):
10031013
pass

0 commit comments

Comments
 (0)