Skip to content

Commit e702f9e

Browse files
committed
fix: correct cancellation notification method name to notifications/cancelled
According to MCP spec, the cancellation notification method should be 'notifications/cancelled' instead of 'cancelled'.
1 parent 4816bed commit e702f9e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/mcp/shared/session.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,11 +292,11 @@ async def _send_response(
292292
def _should_validate_notification(self, message_root: JSONRPCNotification) -> bool:
293293
"""
294294
Determines if a notification should be validated.
295-
Internal notifications (like cancelled) should be ignored.
295+
Internal notifications (like notifications/cancelled) should be ignored.
296296
"""
297297
try:
298298
return (
299-
getattr(message_root, "method", None) != "cancelled" and
299+
getattr(message_root, "method", None) != "notifications/cancelled" and
300300
not self._closed
301301
)
302302
except:

0 commit comments

Comments
 (0)