File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
examples/snippets/clients Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 2424
2525import asyncio
2626import json
27+ import logging
2728import webbrowser
2829from typing import Any
2930from urllib .parse import urlparse
3435from mcp .shared .exceptions import McpError , UrlElicitationRequiredError
3536from mcp .types import URL_ELICITATION_REQUIRED
3637
38+ logger = logging .getLogger (__name__ )
39+
3740
3841async def handle_elicitation (
3942 context : RequestContext [ClientSession , Any ],
@@ -115,8 +118,8 @@ async def handle_url_elicitation(
115118 print (f"\n Opening browser to: { url } " )
116119 try :
117120 webbrowser .open (url )
118- except Exception as e :
119- print ( f "Failed to open browser: { e } " )
121+ except Exception :
122+ logger . exception ( "Failed to open browser" )
120123 print (f"Please manually open: { url } " )
121124
122125 print ("Waiting for you to complete the interaction in your browser..." )
You can’t perform that action at this time.
0 commit comments