fix: Undo adding MCP tools output schema to FunctionDeclaration

Co-authored-by: Xuan Yang <xygoogle@google.com>
PiperOrigin-RevId: 827557144
This commit is contained in:
Xuan Yang
2025-11-03 10:31:58 -08:00
committed by Copybara-Service
parent a02f321f1b
commit 92a7d19573
2 changed files with 0 additions and 45 deletions
@@ -121,13 +121,10 @@ class McpTool(BaseAuthenticatedTool):
"""
input_schema = self._mcp_tool.inputSchema
parameters = _to_gemini_schema(input_schema)
output_schema = self._mcp_tool.outputSchema
response = _to_gemini_schema(output_schema)
function_decl = FunctionDeclaration(
name=self.name,
description=self.description,
parameters=parameters,
response=response,
)
return function_decl
@@ -150,48 +150,6 @@ class TestMCPTool:
assert declaration.parameters is not None
assert declaration.response is None
def test_get_declaration_with_output_schema(self):
"""Test function declaration generation with an output schema."""
self.mock_mcp_tool.outputSchema = {
"type": "object",
"properties": {
"status": {
"type": "string",
"description": "The status of the operation",
},
},
}
tool = MCPTool(
mcp_tool=self.mock_mcp_tool,
mcp_session_manager=self.mock_session_manager,
)
declaration = tool._get_declaration()
assert isinstance(declaration, FunctionDeclaration)
assert declaration.response is not None
assert declaration.response.type == Type.OBJECT
assert "status" in declaration.response.properties
assert declaration.response.properties["status"].type == Type.STRING
assert (
declaration.response.properties["status"].description
== "The status of the operation"
)
def test_get_declaration_with_empty_output_schema(self):
"""Test function declaration with an empty output schema."""
self.mock_mcp_tool.outputSchema = {}
tool = MCPTool(
mcp_tool=self.mock_mcp_tool,
mcp_session_manager=self.mock_session_manager,
)
declaration = tool._get_declaration()
assert declaration.response is not None
assert declaration.response.type == Type.OBJECT
assert declaration.response.properties is None
@pytest.mark.asyncio
async def test_run_async_impl_no_auth(self):
"""Test running tool without authentication."""