From 6a2253d458f3dec12e37efe58673c623a4ea6028 Mon Sep 17 00:00:00 2001 From: Joshua Valluru <326636767+joshua-berri@users.noreply.github.com> Date: Tue, 20 Oct 2026 16:37:13 -0700 Subject: [PATCH] test(mcp): register limit cases and discover configured tools --- tests/integration/contracts.json | 5 ++++- tests/integration/mcp/test_mcp_protocol_errors.py | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/integration/contracts.json b/tests/integration/contracts.json index a46e597d5b3..21436c593c8 100644 --- a/tests/integration/contracts.json +++ b/tests/integration/contracts.json @@ -191,7 +191,10 @@ "tests/integration/observability/test_guardrail_effects.py::test_guardrail_denial_prevents_provider_and_preserves_allowed_control": [ "other.observability.guardrails.denial_prevents_provider_with_allowed_control" ], - "tests/integration/mcp/test_mcp_protocol_errors.py::test_tool_result_larger_than_one_mib_in_a_single_sse_event_reaches_the_caller": [ + "tests/integration/mcp/test_mcp_protocol_errors.py::test_tool_result_larger_than_one_mib_in_a_single_sse_event_reaches_the_caller[67108864]": [ + "other.mcp.transport.large_sse_tool_result_reaches_caller" + ], + "tests/integration/mcp/test_mcp_protocol_errors.py::test_tool_result_larger_than_one_mib_in_a_single_sse_event_reaches_the_caller[4096]": [ "other.mcp.transport.large_sse_tool_result_reaches_caller" ], "tests/integration/mcp/test_mcp_protocol_errors.py::test_jsonrpc_error_and_malformed_tool_result_remain_errors": [ diff --git a/tests/integration/mcp/test_mcp_protocol_errors.py b/tests/integration/mcp/test_mcp_protocol_errors.py index 4670c5a683f..73573c6ab3d 100644 --- a/tests/integration/mcp/test_mcp_protocol_errors.py +++ b/tests/integration/mcp/test_mcp_protocol_errors.py @@ -168,9 +168,11 @@ def test_tool_result_larger_than_one_mib_in_a_single_sse_event_reaches_the_calle config=config, remove_environment=("DATABASE_URL", "DATABASE_URL_READ_REPLICA", "DIRECT_URL"), ) as gateway: - names: Final = tool_names(gateway, key, "big") + listed: Final = gateway.client.get("/mcp-rest/tools/list", headers={"x-litellm-api-key": key}) + assert listed.status_code == 200, listed.text[:500] + assert {tool["name"] for tool in listed.json()["tools"]} == {"add"} for size in (512, len(payload), 512): - response: Final = call_tool(gateway, key, "big", names["add"], {"size": size}) + response: Final = call_tool(gateway, key, "big", "add", {"size": size}) assert response.status_code == 200, response.text[:500] body: Final = response.json() assert body["isError"] is (size > limit), response.text[:500]