Commit c332dd5
committed
fix(cli): use Optional[List[str]] in cleanup_unused_files to fix parser error
ADK's automatic function calling system cannot parse the PEP 604 union
syntax `list[str] | None` when building the tool schema for Gemini.
This causes the following error every time the ADK web server runs:
Failed to parse the parameter file_patterns: List[str] | None = None
of function cleanup_unused_files for automatic function calling
All sibling tools in this directory (delete_files.py, read_files.py,
write_files.py, etc.) already use `Optional[List[str]]` from `typing`.
This commit aligns cleanup_unused_files.py with that established pattern.
Changes:
- Add `from typing import List` and `from typing import Optional`
- Replace `list[str] | None` with `Optional[List[str]]` on both optional
parameters (file_patterns, exclude_patterns)
- Change `used_files: list[str]` to `used_files: List[str]` for style
consistency with sibling tools
Fixes #35911 parent d00ad67 commit c332dd5
1 file changed
Lines changed: 5 additions & 3 deletions
Lines changed: 5 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
| |||
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
28 | | - | |
| 30 | + | |
29 | 31 | | |
30 | | - | |
31 | | - | |
| 32 | + | |
| 33 | + | |
32 | 34 | | |
33 | 35 | | |
34 | 36 | | |
| |||
0 commit comments