fix(adk): support map additionalProperties and bind_param in ToolboxTool - #737
Open
hsusul wants to merge 1 commit into
Open
fix(adk): support map additionalProperties and bind_param in ToolboxTool#737hsusul wants to merge 1 commit into
hsusul wants to merge 1 commit into
Conversation
This was referenced Jul 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ToolboxToolintoolbox-adkignoredadditionalPropertiesonobject/mapparameter schemas when building ADKFunctionDeclarationobjects (leavingadditional_properties=None). Additionally,ToolboxToollacked thebind_paramconvenience method available in other packages and threwTypeErrorwhen callingbind_paramswith the keyword argumentbound_params.toolbox_adk.tool.ToolboxTool._build_schema,schema_additional_propertiesis now populated fromparam.additionalPropertiesand passed togoogle.genai.types.Schema(..., additional_properties=...). Updatedbind_paramsto accept keyword argumentbound_params(preserving backward compatibility withbounded_params), and addedbind_param.test_get_declaration_additional_propertiesandtest_bind_param_and_bind_params_keywordinpackages/toolbox-adk/tests/unit/test_tool.py.Problem
ToolboxToolwas loaded for a tool containing a dictionary/map parameter (such asmap<string, string>),_build_schemacreated aSchema(type=Type.OBJECT)without mappingadditionalProperties. As a result, Gemini/ADK function declarations lost value schema constraints for map parameters.ToolboxToolintoolbox-adkdiverged fromtoolbox-core,toolbox-langchain, andtoolbox-llamaindexby missing thebind_paramsingular method and rejectingbound_paramsas a keyword argument name.Root cause
toolbox_adk.tool.ToolboxTool._build_schema,schema_additional_properties = Nonewas initialized, but never populated fromparam.additionalPropertiesand omitted from theSchema(...)constructor arguments.ToolboxToolintoolbox-adknamed its parameterbounded_paramsinstead ofbound_paramsand did not implementbind_param.Fix
packages/toolbox-adk/src/toolbox_adk/tool.py:param.additionalPropertiesin_build_schemaand recursively converted it when present (or assigned boolean value when bool), passingadditional_properties=schema_additional_propertiestoSchema(...).bind_paramsto acceptbound_params(while preservingbounded_paramsfallback for backward compatibility).bind_param(param_name, param_value)to delegate tobind_params({param_name: param_value}).Tests
packages/toolbox-adk/tests/unit/test_tool.py:test_get_declaration_additional_properties: VerifiesFunctionDeclarationschema preservation for typed and booleanadditionalProperties.test_bind_param_and_bind_params_keyword: Verifies callingbind_paramandbind_params(bound_params=...).Validation
PYTHONPATH=. /tmp/sdk_env/bin/pytest tests/unit -vinsidepackages/toolbox-adk: 56 passed.black --check .,isort --check ., andMYPYPATH='./src' mypy --cache-dir=.mypy_cache/ -p toolbox_adkinpackages/toolbox-adk: all passed with zero errors.Compatibility
bind_paramscallers while aligningtoolbox-adkAPI withtoolbox-core,toolbox-langchain, andtoolbox-llamaindex.Non-goals
ParameterSchemaor transport schema conversion logic.