genkit icon indicating copy to clipboard operation
genkit copied to clipboard

test(py/plugins/mcp): cover an output-schema violation through a real McpClient tool

Open hilariie opened this issue 3 weeks ago • 0 comments

When a server returns a tool result that violates the tool's declared output schema, the tool action catches _ToolResultError and hands the model an isError result instead of failing generate. Each piece is tested on its own: mcp_tools_test.py builds the isError result from a stub call, and mcp_connection_test.py checks the connection raises _ToolResultError with the SDK's wording. Nothing tests the whole path.

No test calls bad_output from tests/fake_server.py through a real McpClient tool handle or action. If the handler stopped catching the error, or the connection started wrapping it into a different GenkitError, generate would fail instead of the model seeing the error, and no test would catch it.

Part of #6194.

hilariie avatar Nov 10 '26 11:11 hilariie