From 138c4cbfcf5734d882c4b6ae27fe596223c25a41 Mon Sep 17 00:00:00 2001 From: Fu-Jie <33599649+Fu-Jie@users.noreply.github.com> Date: Mon, 9 Mar 2026 05:46:56 +0800 Subject: [PATCH] fix: filter out internal tool methods starting with underscore (#22408) --- backend/open_webui/utils/tools.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/open_webui/utils/tools.py b/backend/open_webui/utils/tools.py index 081e2f5fa..e525a8284 100644 --- a/backend/open_webui/utils/tools.py +++ b/backend/open_webui/utils/tools.py @@ -707,8 +707,8 @@ def get_functions_from_tool(tool: object) -> list[Callable]: getattr(tool, func) ) # checks if the attribute is callable (a method or function). and not func.startswith( - "__" - ) # filters out special (dunder) methods like init, str, etc. — these are usually built-in functions of an object that you might not need to use directly. + "_" + ) # filters out internal methods (starting with _) and special (dunder) methods. and not inspect.isclass( getattr(tool, func) ) # ensures that the callable is not a class itself, just a method or function.