Describe the bug
When using an MCP server (specifically via FastMCP) as a tool with the google-genai SDK, the internal utility function _filter_to_supported_schema fails with an AttributeError.
The issue occurs because the function assumes that additionalProperties (or additional_properties) is always a dictionary, whereas the JSON Schema specification allows these fields to be a boolean (e.g., "additionalProperties": false).
Root Cause
In google/genai/_mcp_utils.py, the _filter_to_supported_schema function recursively iterates over schema fields. When it encounters additionalProperties: False, it passes the boolean value False back into itself.
def _filter_to_supported_schema(schema):
# some code
for field_name, field_value in schema.items(): # Throws AttributeError if schema is a bool
if field_name in schema_field_names:
filtered_schema[field_name] = _filter_to_supported_schema(field_value)
Environment details
- Package version: 1.74.0, 1.75.0
- Python version: 3.14
- OS: macOS / Ubuntu 24.04
Steps to reproduce
- Use the Gemini Live GenAI Python SDK example.
- Connect a FastMCP server as a tool.
- If the tool's output schema or input parameters include "additionalProperties": false (common in Pydantic-generated schemas used by FastMCP), the SDK crashes.
Suggested Fix
The function should check if the schema is a dictionary before attempting to call .items(). If it's a boolean, it should be returned as-is or handled appropriately.
def _filter_to_supported_schema(schema):
if not isinstance(schema, dict):
return schema
# ... rest of the logic
Describe the bug
When using an MCP server (specifically via FastMCP) as a tool with the google-genai SDK, the internal utility function _filter_to_supported_schema fails with an AttributeError.
The issue occurs because the function assumes that additionalProperties (or additional_properties) is always a dictionary, whereas the JSON Schema specification allows these fields to be a boolean (e.g., "additionalProperties": false).
Root Cause
In
google/genai/_mcp_utils.py, the_filter_to_supported_schemafunction recursively iterates over schema fields. When it encountersadditionalProperties: False, it passes the boolean value False back into itself.Environment details
Steps to reproduce
Suggested Fix
The function should check if the schema is a dictionary before attempting to call .items(). If it's a boolean, it should be returned as-is or handled appropriately.