Improper Await Handling in unregister_toolgroup Method
System Info
Python Version: 3.13.2 (main, Feb 4 2025, 14:51:09) [Clang 16.0.0 (clang-1600.0.26.6)] Python Implementation: CPython Python Compiler: Clang 16.0.0 (clang-1600.0.26.6) Platform: Darwin 23.4.0 Machine: arm64 Processor: arm Python Executable Path: /Users/user/.pyenv/versions/3.11/envs/llamastack/bin/python
Information
- [ ] The official example scripts
- [ ] My own modified scripts
🐛 Describe the bug
Code
client.toolgroups.unregister(toolgroup_id="mcp::docling")
Issue:
unregister_toolgroup accessed .data directly on an awaited coroutine, causing an AttributeError when list_tools(toolgroup_id) returned an unresolved coroutine.
Potential Fix:
- tools = await self.list_tools(toolgroup_id).data
+ tools_response = await self.list_tools(toolgroup_id)
+ tools = tools_response.data
Error logs
File "github.com/llama-stack/llama_stack/distribution/routers/routing_tables.py", line 533, in unregister_toolgroup
tools = await self.list_tools(toolgroup_id).data
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'coroutine' object has no attribute 'data'
Expected behavior
No error
This issue has been automatically marked as stale because it has not had activity within 60 days. It will be automatically closed if no further activity occurs within 30 days.
This was fixed some time back by #1704