Skip to content

fix: use typing.Optional[List[str]] in cleanup_unused_files to fix automatic function calling parse error - #6502

Closed
guptaishaan wants to merge 1 commit into
google:mainfrom
guptaishaan:fix/issue-3591-9437
Closed

guptaishaan wants to merge 1 commit into
google:mainfrom
guptaishaan:fix/issue-3591-9437

Conversation

@guptaishaan

Copy link
Copy Markdown
Contributor

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.

The fix replaces the two affected parameters (file_patterns and used_files) with Optional[List[str]] and List[str] from the typing module, which is the style already used throughout the other tool files in the same package (e.g. delete_files.py). No behaviour change — only the type annotation form is updated.

Fixes #3591.

…tomatic 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 <[email protected]>
@adk-bot adk-bot added the tools [Component] This issue is related to tools label Jul 28, 2026
copybara-service Bot pushed a commit that referenced this pull request Aug 4, 2026
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.

The fix replaces the two affected parameters (`file_patterns` and `used_files`) with `Optional[List[str]]` and `List[str]` from the `typing` module, which is the style already used throughout the other tool files in the same package (e.g. `delete_files.py`). No behaviour change — only the type annotation form is updated.

Fixes #3591

Merge #6502

PiperOrigin-RevId: 958737849
@adk-bot

adk-bot commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Thank you @guptaishaan for your contribution! 🎉

Your changes have been successfully imported and merged via Copybara in commit cbedafd.

Closing this PR as the changes are now in the main branch.

@adk-bot adk-bot added the merged [Status] This PR is merged label Aug 4, 2026
@adk-bot adk-bot closed this Aug 4, 2026
FrigaZzz pushed a commit to FrigaZzz/adk-python that referenced this pull request Aug 11, 2026
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.

The fix replaces the two affected parameters (`file_patterns` and `used_files`) with `Optional[List[str]]` and `List[str]` from the `typing` module, which is the style already used throughout the other tool files in the same package (e.g. `delete_files.py`). No behaviour change — only the type annotation form is updated.

Fixes google#3591

Merge google#6502

PiperOrigin-RevId: 958737849
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged [Status] This PR is merged tools [Component] This issue is related to tools

Projects

None yet

3 participants