From 0b636aecfac0c0dac806796caca6ea262c4b5b01 Mon Sep 17 00:00:00 2001 From: Ishaan Date: Fri, 31 Jul 2026 09:03:33 +0000 Subject: [PATCH] fix: use Optional[list[str]] instead of list[str] | None in cleanup_unused_files to fix schema parsing error The `cleanup_unused_files` tool function used the `X | None` union type syntax (PEP 604) for the `file_patterns` and `exclude_patterns` parameters. The ADK automatic function calling schema generator fails to parse this syntax, causing the error: 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.