From 45f489bea89c529c21392edff051a9c453e4edd5 Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Sun, 22 Nov 2026 17:28:37 +0100 Subject: [PATCH] fix: chats fail when a Tether OpenAPI tool has the same name as another tool (#34730) When two tool servers offer a tool with the same name, Open WebUI puts the server ID in front of the second one so the model can tell them apart. Tool servers added in Tether have IDs with colons, so the renamed tool broke the name rules of OpenAI-compatible providers and the provider rejected the whole chat for an invalid tool name. The same happened for admin tool servers whose ID has a dot. Characters outside letters, digits, underscores and dashes are now replaced with underscores in the renamed tool, and calls still reach the right server. Same cause as #34718, which covered MCP servers from Tether. Fixes #34729 --- backend/open_webui/utils/tools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/open_webui/utils/tools.py b/backend/open_webui/utils/tools.py index 3f0c11935c..3cb2970e6f 100644 --- a/backend/open_webui/utils/tools.py +++ b/backend/open_webui/utils/tools.py @@ -609,7 +609,7 @@ async def get_tools(request: Request, tool_ids: list[str], user: UserModel, extr while function_name in tools_dict: log.warning(f'Tool {function_name} already exists in another tools!') # Prepend server ID to function name - function_name = f'{server_id}_{function_name}' + function_name = re.sub(r'[^a-zA-Z0-9_-]', '_', f'{server_id}_{function_name}') tool_dict['spec'] = {**tool_dict['spec'], 'name': function_name} tools_dict[function_name] = tool_dict