Skip to content

feat(tools): Support tuple tool parameters#6076

Open
RaghunandanKumar wants to merge 6 commits into
google:mainfrom
RaghunandanKumar:fix/issue-3575
Open

feat(tools): Support tuple tool parameters#6076
RaghunandanKumar wants to merge 6 commits into
google:mainfrom
RaghunandanKumar:fix/issue-3575

Conversation

@RaghunandanKumar

Copy link
Copy Markdown

Summary

  • Support homogeneous tuple annotations such as tuple[float, float] and tuple[str, ...] in automatic function declarations.
  • Parse supported tuples as array schemas instead of falling back to Pydantic JSON schema fields that google.genai.types.Schema rejects.
  • 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 -q
  • uv run pytest tests/unittests/tools -q
  • uv run pre-commit run --files src/google/adk/tools/_function_parameter_parse_util.py tests/unittests/tools/test_from_function_with_options.py

Parse homogeneous tuple annotations as array schemas for automatic function declarations instead of falling back to Pydantic JSON schema output that GenAI Schema rejects.

Fixes google#3575
@adk-bot adk-bot added the tools [Component] This issue is related to tools label Jun 11, 2026
@RaghunandanKumar RaghunandanKumar marked this pull request as ready for review June 11, 2026 02:55
@rohityan rohityan self-assigned this Jun 11, 2026
@rohityan rohityan added the request clarification [Status] The maintainer need clarification or more information from the author label Jun 11, 2026
@rohityan

Copy link
Copy Markdown
Collaborator

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.

@RaghunandanKumar

Copy link
Copy Markdown
Author

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 passed
  • uv 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-overlap error 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

request clarification [Status] The maintainer need clarification or more information from the author tools [Component] This issue is related to tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Tuple for function tool signature

3 participants