Description
Please read this first
- Have you read the docs?Agents SDK docs
- Have you searched for related issues? Others may have had similar requests
Question
Describe your question. Provide details if available.
when I run asyncio.run(server_stdio),an error occurs:
正在连接到MCP服务器...
MCP服务器连接成功!
Processing request of type ListToolsRequest
可用工具列表:
- add: Add two numbers
- get_secret_word: 获取随机单词
an error occurred during closing of asynchronous generator <async_generator object stdio_client at 0x7fbf396614c0>
asyncgen: <async_generator object stdio_client at 0x7fbf396614c0>
- Exception Group Traceback (most recent call last):
| File "/home/huangziqi/miniconda3/envs/py310/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 773, in aexit
| raise BaseExceptionGroup(
| exceptiongroup.BaseExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
+-+---------------- 1 ----------------
| Traceback (most recent call last):
| File "/home/huangziqi/miniconda3/envs/py310/lib/python3.10/site-packages/mcp/client/stdio/init.py", line 187, in stdio_client
| yield read_stream, write_stream
| GeneratorExit
+------------------------------------
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/huangziqi/miniconda3/envs/py310/lib/python3.10/site-packages/mcp/client/stdio/init.py", line 179, in stdio_client
async with (
File "/home/huangziqi/miniconda3/envs/py310/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 779, in aexit
if self.cancel_scope.exit(type(exc), exc, exc.traceback):
File "/home/huangziqi/miniconda3/envs/py310/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 457, in exit
raise RuntimeError(
RuntimeError: Attempted to exit cancel scope in a different task than it was entered in