Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
fix(python): preserve nested array item schemas for Google ADK (#4986)
## Summary Fixes #4983. Google ADK tools currently expose unconstrained array items when the input item schema uses `anyOf`/`oneOf` instead of a direct `type`. The equivalent list-valued `type` already preserves nullable items. This loses model-facing constraints without raising an error. ## Changes - Resolve array items through the existing schema converter even when `items.type` is absent. - Dispatch typeless nested combiners through the existing union/allOf helpers; preserve the prior enum/explicit-type precedence, object fallback, and unconstrained-schema behavior. - Bound recursive conversion at 64 levels, falling back to `Any` rather than recursing indefinitely. This bounds this converter, not every preprocessing stage in the SDK. - Add helper regressions and an offline test through the real `GoogleAdkProvider` and ADK tool declaration. No provider API, dependencies, or execution behavior changes. ## Type of change - [x] Bug fix - [ ] New feature - [ ] Refactor/Chore - [ ] Documentation - [ ] Breaking change ## How Has This Been Tested? Windows, Python 3.12.11; editable core/provider packages; google-genai 2.31.0, pydantic 2.14.1, pytest 9.1.1, Ruff 0.17.1. From `python/`: ```sh python -m pytest tests/test_openapi.py tests/test_google_adk_provider.py -q # 39 passed. Initially 8 failed before the item-schema fix (21 passed); # review regressions for depth and sibling precedence also failed before their fixes. python -m pytest tests/test_openapi.py tests/test_google_adk_provider.py tests/test_provider.py -q # 61 passed, 11 skipped (other optional providers are not installed). python -m ruff check --config config/ruff.toml composio/utils/openapi.py tests/test_openapi.py tests/test_google_adk_provider.py python -m ruff format --check --config config/ruff.toml composio/utils/openapi.py tests/test_openapi.py tests/test_google_adk_provider.py python -m ruff check --select I composio/utils/openapi.py tests/test_openapi.py tests/test_google_adk_provider.py git diff --check ``` All listed lint/format/diff checks pass. The four ADK declaration cases pass with both google-adk **2.12.0** and the provider's minimum **2.5.0**, in separate environments. These cover nullable items and a 96-level input exceeding the converter budget. Helper tests separately exercise 400-level combiners/arrays. A 400-level full-wrapper experiment instead fails earlier in the existing `alias_tool_input_schema` deepcopy; this PR does not fix or conceal that separate preprocessing limit. DNS/socket connections are blocked during declaration generation; no tool execution or model/API call is made. ADK emits its existing experimental JSON-schema feature warning. The optional provider test skips when `composio_google_adk` is not installed; the core helper regressions do not. The existing main Python CI does not install that optional provider. Additional checks were **not fully green**: - Adding `tests/test_schema_converter.py` to the three-file run: **275 passed, 11 skipped, 1 failed**. The failure is the existing `primitive-unicode-code-point-length[0]` case (`glyph: '𝄞' is too long`). Replacing only the changed production module in memory with the exact upstream version at `2d868cf88ce485db7076222aaa81045e524dddb7`, in the same environment, reproduces this same failure. No existing assertion was changed or skipped. - `python -m mypy --config-file config/mypy.ini composio/utils/openapi.py tests/test_openapi.py tests/test_google_adk_provider.py`, using the repository's mypy **2.3.1** and pinned type stubs: one error in the imported, unchanged `composio/utils/schema_converter.py:813` (`TypeAdapter` argument versus `TypeForm[Any]`). Checking that unchanged module alone reproduces the error. No type-check configuration or ignore was added. These are local results, not a claim that full `make chk`, `make tst`, live integration tests, or GitHub CI passed. ## Screenshots (if applicable) Not applicable. ## Checklist - [x] I have read the Code of Conduct and this PR adheres to it - [x] I have read and understand every line of this diff, including any LLM-generated code (Codex-assisted review; see below) - [x] Any third-party docs links or promotional content follow the third-party links policy (none added) - [ ] I ran linters/tests locally and they passed - [x] I updated documentation as needed (internal conversion fix; no usage/API changes) - [x] I added tests or explain why not applicable - [x] I added a changeset if this change affects published packages (not applicable: Python-only) ## Additional context Prepared with OpenAI Codex under gtdd123's standing authorization. The complete diff was read and reviewed by Codex, including the recursive conversion behavior and all regression assertions. Codex ran the checks above and checked current issue/PR overlap. This describes the automated review, not a separate personal review by the account owner. The test checkbox remains unchecked because the additional checks above have known failures. No human review or live-provider validation is claimed. This is separate from the Google/Vertex work in #4751 and the existing list-valued-type fix #3822. The branch was fast-forwarded to `next` at `fc33028fa85f0c66c95ff70f45557725ab1ae4e2` before the final focused test run. --------- Co-authored-by: jkomyno <alberto@composio.dev>