Skip to content

Commit a3e74fc

Browse files
committed
perf: early-return in get_tools() for empty tool_ids
Avoids a needless Groups.get_groups_by_member_id() query when no tools are attached to the request.
1 parent 57c9916 commit a3e74fc

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

backend/open_webui/utils/tools.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,9 @@ async def get_tools(
163163
request: Request, tool_ids: list[str], user: UserModel, extra_params: dict
164164
) -> dict[str, dict]:
165165
"""Load tools for the given tool_ids, checking access control."""
166+
if not tool_ids:
167+
return {}
168+
166169
tools_dict = {}
167170

168171
# Get user's group memberships for access control checks

0 commit comments

Comments
 (0)