Skip to content

Commit 580e192

Browse files
sararobcopybara-github
authored andcommitted
chore: Update Agent Platform MCP util to pass schema directly to backend
PiperOrigin-RevId: 911915735
1 parent 0549c1c commit 580e192

2 files changed

Lines changed: 26 additions & 3 deletions

File tree

google/genai/_mcp_utils.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,7 @@ def agent_platform_to_gemini_tool(tool: McpTool) -> types.Tool:
5858
{
5959
"name": tool.name,
6060
"description": tool.description,
61-
"parameters_json_schema": _filter_to_supported_schema(
62-
tool.inputSchema
63-
),
61+
"parameters_json_schema": tool.inputSchema,
6462
}
6563
]
6664
)

google/genai/tests/mcp/test_mcp_to_gemini_tools.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,3 +276,28 @@ def test_update_endpoint_labels_conversion():
276276
labels_schema = schema['properties']['endpoint']['properties']['labels']
277277

278278
assert 'additionalProperties' in labels_schema
279+
280+
281+
def test_agent_platform_preserves_unknown_fields():
282+
"""Test that Agent Platform translation passes all schema fields directly
283+
to the backend.
284+
"""
285+
mcp_tools = [
286+
mcp_types.Tool(
287+
name='tool',
288+
description='tool-description',
289+
inputSchema={
290+
'type': 'object',
291+
'properties': {},
292+
# A new unknown field
293+
'some_new_future_field': 'value',
294+
},
295+
),
296+
]
297+
298+
result = _mcp_utils.mcp_to_gemini_tools(mcp_tools, is_agent_platform=True)
299+
schema = result[0].function_declarations[0].parameters_json_schema
300+
301+
# Verify the entire schema is passed through intact, including the unknown field
302+
assert 'some_new_future_field' in schema
303+
assert schema['some_new_future_field'] == 'value'

0 commit comments

Comments
 (0)