feat(tools): Support tuple tool parameters
Summary
- Support homogeneous tuple annotations such as
tuple[float, float]andtuple[str, ...]in automatic function declarations. - Parse supported tuples as array schemas instead of falling back to Pydantic JSON schema fields that
google.genai.types.Schemarejects. - Add regression coverage for tuple tool parameters and optional tuple parameters.
Fixes #3575
Verification
uv run pytest tests/unittests/tools/test_from_function_with_options.py -quv run pytest tests/unittests/tools -quv run pre-commit run --files src/google/adk/tools/_function_parameter_parse_util.py tests/unittests/tools/test_from_function_with_options.py
Hi @RaghunandanKumar , Thank you for your contribution! We appreciate you taking the time to submit this pull request. Can you please fix the failing mypy-diff tests before we can proceed with the review.
Hi @rohityan, I pushed a follow-up fix in 703a108e for the failing mypy-diff check.
The issue was the new tuple handling comparing the typed get_origin(...) result against tuple, which mypy reported as a new comparison-overlap error. I typed the local origin value as Any before the runtime origin checks and kept the tuple behavior unchanged.
Local verification:
uv run pytest tests/unittests/tools/test_from_function_with_options.py-> 17 passeduv run pyink src/google/adk/tools/_function_parameter_parse_util.py tests/unittests/tools/test_from_function_with_options.py --check-> passed- Re-ran the CI-style mypy error filter; the new tuple
comparison-overlaperror is no longer present. The remaining output matches existing repo baseline errors.
The new PR head currently shows check-changes, cla/google, and header-check passing; the mypy/test workflows have not appeared in the check rollup yet.
Thank you @RaghunandanKumar for your contribution! 🎉
Your changes have been successfully imported and merged via Copybara in commit a57c3e4.
Closing this PR as the changes are now in the main branch.