File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
pydantic_ai_slim/pydantic_ai Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -110,8 +110,11 @@ async def list_tools(self) -> list[mcp_types.Tool]:
110110 - We don't cache tools as they might change.
111111 - We also don't subscribe to the server to avoid complexity.
112112 """
113- async with self : # Ensure server is running
114- result = await self ._client .list_tools ()
113+ try :
114+ async with self : # Ensure server is running
115+ result = await self ._client .list_tools ()
116+ except anyio .get_cancelled_exc_class ():
117+ return []
115118 return result .tools
116119
117120 async def direct_call_tool (
@@ -206,6 +209,7 @@ async def __aenter__(self) -> Self:
206209 self ._read_stream , self ._write_stream = await self ._exit_stack .enter_async_context (
207210 self .client_streams ()
208211 )
212+
209213 client = ClientSession (
210214 read_stream = self ._read_stream ,
211215 write_stream = self ._write_stream ,
You can’t perform that action at this time.
0 commit comments