fix: filter out internal tool methods starting with underscore (#22408)

This commit is contained in:
Fu-Jie
2026-03-08 16:46:56 -05:00
committed by GitHub
parent 7a3c5c0f8a
commit 138c4cbfcf
+2 -2
View File
@@ -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.