-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
bot triaged[Bot] This issue is triaged by ADK bot[Bot] This issue is triaged by ADK bottools[Component] This issue is related to tools[Component] This issue is related to tools
Description
Describe the bug
I'm trying a project similarly structured to adk-mcp-tutorial - local_mcp.
However, whenever I try to run the project (including my own similarly structured repo), I get the following error:
2025-07-28 01:27:04,829 - ERROR - fast_api.py:928 - Error in event_generator: unhandled errors in a TaskGroup (1 sub-exception)
+ Exception Group Traceback (most recent call last):
| File "path_to_folder\AgentDevelopmentKit\venv-windows\Lib\site-packages\google\adk\cli\fast_api.py", line 916, in event_generator
| async for event in runner.run_async(
| File "path_to_folder\AgentDevelopmentKit\venv-windows\Lib\site-packages\google\adk\runners.py", line 233, in run_async
| async for event in self._exec_with_plugin(
| File "path_to_folder\AgentDevelopmentKit\venv-windows\Lib\site-packages\google\adk\runners.py", line 273, in _exec_with_plugin
| async for event in execute_fn(invocation_context):
| File "path_to_folder\AgentDevelopmentKit\venv-windows\Lib\site-packages\google\adk\runners.py", line 230, in execute
| async for event in ctx.agent.run_async(ctx):
| File "path_to_folder\AgentDevelopmentKit\venv-windows\Lib\site-packages\google\adk\agents\base_agent.py", line 209, in run_async
| async for event in self._run_async_impl(ctx):
| File "path_to_folder\AgentDevelopmentKit\venv-windows\Lib\site-packages\google\adk\agents\llm_agent.py", line 283, in _run_async_impl
| async for event in self._llm_flow.run_async(ctx):
| File "path_to_folder\AgentDevelopmentKit\venv-windows\Lib\site-packages\google\adk\flows\llm_flows\base_llm_flow.py", line 290, in run_async
| async for event in self._run_one_step_async(invocation_context):
| File "path_to_folder\AgentDevelopmentKit\venv-windows\Lib\site-packages\google\adk\flows\llm_flows\base_llm_flow.py", line 306, in _run_one_step_async
| async for event in self._preprocess_async(invocation_context, llm_request):
| File "path_to_folder\AgentDevelopmentKit\venv-windows\Lib\site-packages\google\adk\flows\llm_flows\base_llm_flow.py", line 357, in _preprocess_async
| tools = await _convert_tool_union_to_tools(
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "path_to_folder\AgentDevelopmentKit\venv-windows\Lib\site-packages\google\adk\agents\llm_agent.py", line 120, in _convert_tool_union_to_tools
| return await tool_union.get_tools(ctx)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "path_to_folder\AgentDevelopmentKit\venv-windows\Lib\site-packages\google\adk\tools\mcp_tool\mcp_session_manager.py", line 128, in wrapper
| return await func(self, *args, **kwargs)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "path_to_folder\AgentDevelopmentKit\venv-windows\Lib\site-packages\google\adk\tools\mcp_tool\mcp_toolset.py", line 150, in get_tools
| session = await self._mcp_session_manager.create_session()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "path_to_folder\AgentDevelopmentKit\venv-windows\Lib\site-packages\google\adk\tools\mcp_tool\mcp_session_manager.py", line 372, in create_session
| await exit_stack.aclose()
| File "c_user_username\AppData\Local\Programs\Python\Python312\Lib\contextlib.py", line 696, in aclose
| await self.__aexit__(None, None, None)
| File "c_user_username\AppData\Local\Programs\Python\Python312\Lib\contextlib.py", line 754, in __aexit__
| raise exc_details[1]
| File "c_user_username\AppData\Local\Programs\Python\Python312\Lib\contextlib.py", line 737, in __aexit__
| cb_suppress = await cb(*exc_details)
| ^^^^^^^^^^^^^^^^^^^^^^
| File "c_user_username\AppData\Local\Programs\Python\Python312\Lib\contextlib.py", line 217, in __aexit__
| await anext(self.gen)
| File "path_to_folder\AgentDevelopmentKit\venv-windows\Lib\site-packages\mcp\client\stdio\__init__.py", line 181, in stdio_client
| anyio.create_task_group() as tg,
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "path_to_folder\AgentDevelopmentKit\venv-windows\Lib\site-packages\anyio\_backends\_asyncio.py", line 772, in __aexit__
| raise BaseExceptionGroup(
| ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
+-+---------------- 1 ----------------
| Traceback (most recent call last):
| File "path_to_folder\AgentDevelopmentKit\venv-windows\Lib\site-packages\mcp\client\stdio\__init__.py", line 160, in stdout_reader
| await read_stream_writer.send(session_message)
| File "path_to_folder\AgentDevelopmentKit\venv-windows\Lib\site-packages\anyio\streams\memory.py", line 242, in send
| self.send_nowait(item)
| File "path_to_folder\AgentDevelopmentKit\venv-windows\Lib\site-packages\anyio\streams\memory.py", line 213, in send_nowait
| raise BrokenResourceError
| anyio.BrokenResourceError
+------------------------------------
This error appears even with the original repo mentioned above.
To Reproduce
Steps to reproduce the behavior:
- Clone the repo [adk-mcp-tutorial](https://github.com/bhancockio/adk-mcp-tutorial/tree/main/local_mcp) or set up a similarly structured project.
- Run the example with
adk web
. - Wait for initialization.
- Observe the crash with
BrokenResourceError
.
Expected behavior
It should communicate with the MCP Server and give the output.
Screenshots
N/A – error is in logs.
Desktop (please complete the following information):
- OS: Windows 11 (using PowerShell and sometimes use WSL also.)
- Python version (python -V): Python 3.12.6
- ADK version (pip show google-adk): 1.8.0
Model Information: N/A
Additional context I'm making the actual code for https://github.com/jcp-tech/smooth-ocean.ai, but the code related to this error isn't committed to the repo at the time of raising this issue.
Metadata
Metadata
Assignees
Labels
bot triaged[Bot] This issue is triaged by ADK bot[Bot] This issue is triaged by ADK bottools[Component] This issue is related to tools[Component] This issue is related to tools