From f7cb66620be843b8d9f3d197d6e8988e9ee0dfca Mon Sep 17 00:00:00 2001 From: Google Team Member Date: Mon, 2 Jun 2025 11:56:48 -0700 Subject: [PATCH] fix: Use inspect.cleandoc on function docstrings in generate_function_declaration. This creates proper indent of the doc. PiperOrigin-RevId: 766285907 --- src/google/adk/tools/function_tool.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/google/adk/tools/function_tool.py b/src/google/adk/tools/function_tool.py index 3a168fb..a3bebd9 100644 --- a/src/google/adk/tools/function_tool.py +++ b/src/google/adk/tools/function_tool.py @@ -46,14 +46,14 @@ class FunctionTool(BaseTool): # Get documentation (prioritize direct __doc__ if available) if hasattr(func, '__doc__') and func.__doc__: - doc = func.__doc__ + doc = inspect.cleandoc(func.__doc__) elif ( hasattr(func, '__call__') and hasattr(func.__call__, '__doc__') and func.__call__.__doc__ ): # For callable objects, try to get docstring from __call__ method - doc = func.__call__.__doc__ + doc = inspect.cleandoc(func.__call__.__doc__) super().__init__(name=name, description=doc) self.func = func