You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR introduces support for the `map` parameter type in the Python SDKs, aligning it with the recent MCP Toolbox server enhancements ([#928](googleapis/genai-toolbox#928)). This allows tools to define parameters that are key-value pairs, either as a generic map with mixed-type values or as a strictly typed map.
## Changes
* The `ParameterSchema` in `protocol.py` has been updated to include an optional `valueType` field.
* The internal `__get_type` method now correctly resolves the `map` type to the appropriate Python `dict` type hint:
* `dict[str, Any]` for generic maps (when `valueType` is omitted).
* `dict[str, <type>]` for typed maps (e.g., `dict[str, str]`, `dict[str, int]`).
## Testing
* Added extensive unit tests to `test_protocol.py` to ensure the `map` type is handled correctly.
* Test coverage includes:
* Generic (untyped) maps.
* Typed maps for `string`, `integer`, `float`, and `boolean`.
* Optional maps.
* Error handling for unsupported `valueType`.
> [!NOTE]
> No modifications were required in `toolbox-langchain` or `toolbox-llamaindex`. They inherit this new functionality directly from `toolbox-core`.
0 commit comments