File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed
examples/simple-mcp-client-core-sse/src Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -41,11 +41,25 @@ impl ClientHandlerCore for MyClientHandler {
4141
4242 async fn handle_notification (
4343 & self ,
44- _notification : NotificationFromServer ,
44+ notification : NotificationFromServer ,
4545 _runtime : & dyn McpClient ,
4646 ) -> std:: result:: Result < ( ) , RpcError > {
47- Err ( RpcError :: internal_error ( )
48- . with_message ( "handle_notification() Not implemented" . to_string ( ) ) )
47+ if let NotificationFromServer :: ServerNotification (
48+ schema:: ServerNotification :: LoggingMessageNotification ( logging_message_notification) ,
49+ ) = notification
50+ {
51+ println ! (
52+ "Notification from server: {}" ,
53+ logging_message_notification. params. data. to_string( )
54+ ) ;
55+ } else {
56+ println ! (
57+ "A {} notification received from the server" ,
58+ notification. method( )
59+ ) ;
60+ } ;
61+
62+ Ok ( ( ) )
4963 }
5064
5165 async fn handle_error (
You can’t perform that action at this time.
0 commit comments