feat: don't silently ignore incorrect toolgroup (#1285)

This commit is contained in:
ehhuang 2025-02-27 05:11:09 -08:00 committed by GitHub
parent 99b6925ad8
commit 0762c61402
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -803,6 +803,11 @@ class ChatAgent(ShieldRunnerMixin):
toolgroup_name, tool_name = self._parse_toolgroup_name(toolgroup_name_with_maybe_tool_name)
tools = await self.tool_groups_api.list_tools(toolgroup_id=toolgroup_name)
if not tools.data:
available_tool_groups = ", ".join(
[t.identifier for t in (await self.tool_groups_api.list_tool_groups()).data]
)
raise ValueError(f"Toolgroup {toolgroup_name} not found, available toolgroups: {available_tool_groups}")
if tool_name is not None and not any(tool.identifier == tool_name for tool in tools.data):
raise ValueError(
f"Tool {tool_name} not found in toolgroup {toolgroup_name}. Available tools: {', '.join([tool.identifier for tool in tools.data])}"