From e2aa73d941a787ef8ef35f910ff9526b71de5ca5 Mon Sep 17 00:00:00 2001 From: Ishaan Date: Tue, 28 Jul 2026 09:03:57 +0000 Subject: [PATCH] fix: use typing.Optional[List[str]] in cleanup_unused_files to fix automatic function calling parse error The `cleanup_unused_files` tool was declared with `list[str] | None` union-type annotations (PEP 604 / Python 3.10+ syntax). ADK's automatic function calling schema parser does not support this syntax, causing the error "Failed to parse the parameter file_patterns: List[str] | None = None" whenever the agent builder assistant was invoked. Signed-off-by: Ishaan --- .../adk/cli/built_in_agents/tools/cleanup_unused_files.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/google/adk/cli/built_in_agents/tools/cleanup_unused_files.py b/src/google/adk/cli/built_in_agents/tools/cleanup_unused_files.py index 6b144e8fde6..99cd43020b4 100644 --- a/src/google/adk/cli/built_in_agents/tools/cleanup_unused_files.py +++ b/src/google/adk/cli/built_in_agents/tools/cleanup_unused_files.py @@ -17,6 +17,8 @@ from __future__ import annotations from typing import Any +from typing import List +from typing import Optional from google.adk.tools.tool_context import ToolContext @@ -25,10 +27,10 @@ async def cleanup_unused_files( - used_files: list[str], + used_files: List[str], tool_context: ToolContext, - file_patterns: list[str] | None = None, - exclude_patterns: list[str] | None = None, + file_patterns: Optional[List[str]] = None, + exclude_patterns: Optional[List[str]] = None, ) -> dict[str, Any]: """Identify and optionally delete unused files in project directories.