File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -441,6 +441,22 @@ async def handler(req: types.ProgressNotification):
441441
442442 return decorator
443443
444+ def cancel_notification (self ):
445+ def decorator (
446+ func : Callable [[str | int , str | None ], Awaitable [None ]],
447+ ):
448+ logger .debug ("Registering handler for ProgressNotification" )
449+
450+ async def handler (req : types .CancelledNotification ):
451+ await func (
452+ req .params .requestId , req .params .reason
453+ )
454+
455+ self .notification_handlers [types .CancelledNotification ] = handler
456+ return func
457+
458+ return decorator
459+
444460 def completion (self ):
445461 """Provides completions for prompts and resource templates"""
446462
@@ -587,12 +603,14 @@ async def _handle_notification(self, notify: Any):
587603 assert type (notify ) in self .notification_handlers
588604
589605 handler = self .notification_handlers [type (notify )]
590- logger . debug (f"Dispatching notification of type { type (notify ).__name__ } " )
606+ print (f"Dispatching notification of type { type (notify ).__name__ } " )
591607
592608 try :
593609 await handler (notify )
594610 except Exception as err :
595611 logger .error (f"Uncaught exception in notification handler: { err } " )
612+ else :
613+ print (f"Not handling { notify } " )
596614
597615
598616async def _ping_handler (request : types .PingRequest ) -> types .ServerResult :
You can’t perform that action at this time.
0 commit comments