From 25a084eedd6f25106170433ae93e6225abf067bc Mon Sep 17 00:00:00 2001 From: Ishaan Date: Sun, 2 Aug 2026 09:03:58 +0000 Subject: [PATCH] fix: use Optional[] instead of X | None in cleanup_unused_files signature The `cleanup_unused_files` tool used the `X | None` union syntax (PEP 604) for its `file_patterns` and `exclude_patterns` parameters. ADK's automatic function calling schema parser does not support this syntax and raises a "Failed to parse the parameter" error at runtime, breaking the builder assistant chat. Signed-off-by: Ishaan --- .../adk/cli/built_in_agents/tools/cleanup_unused_files.py | 5 +++-- 1 file changed, 3 insertions(+), 2 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..684208f64cd 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,7 @@ from __future__ import annotations from typing import Any +from typing import Optional from google.adk.tools.tool_context import ToolContext @@ -27,8 +28,8 @@ async def cleanup_unused_files( 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.