Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions google/genai/_mcp_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,7 @@ def agent_platform_to_gemini_tool(tool: McpTool) -> types.Tool:
{
"name": tool.name,
"description": tool.description,
"parameters_json_schema": _filter_to_supported_schema(
tool.inputSchema
),
"parameters_json_schema": tool.inputSchema,
}
]
)
Expand Down
25 changes: 25 additions & 0 deletions google/genai/tests/mcp/test_mcp_to_gemini_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,3 +276,28 @@ def test_update_endpoint_labels_conversion():
labels_schema = schema['properties']['endpoint']['properties']['labels']

assert 'additionalProperties' in labels_schema


def test_agent_platform_preserves_unknown_fields():
"""Test that Agent Platform translation passes all schema fields directly
to the backend.
"""
mcp_tools = [
mcp_types.Tool(
name='tool',
description='tool-description',
inputSchema={
'type': 'object',
'properties': {},
# A new unknown field
'some_new_future_field': 'value',
},
),
]

result = _mcp_utils.mcp_to_gemini_tools(mcp_tools, is_agent_platform=True)
schema = result[0].function_declarations[0].parameters_json_schema

# Verify the entire schema is passed through intact, including the unknown field
assert 'some_new_future_field' in schema
assert schema['some_new_future_field'] == 'value'
Loading