From e280439629fa3f6eb2bafde151346566a07e2dc5 Mon Sep 17 00:00:00 2001 From: mateo-berri <277851410+mateo-berri@users.noreply.github.com> Date: Mon, 19 Oct 2026 16:06:07 -0700 Subject: [PATCH] style(sdk): drop docstrings from the MCP gateway pre-check and its tests --- litellm/responses/mcp/tool_precheck.py | 10 ---------- tests/unit/responses/mcp/test_tool_precheck.py | 8 -------- 2 files changed, 18 deletions(-) diff --git a/litellm/responses/mcp/tool_precheck.py b/litellm/responses/mcp/tool_precheck.py index b6957d9f26a..b76f4066e6d 100644 --- a/litellm/responses/mcp/tool_precheck.py +++ b/litellm/responses/mcp/tool_precheck.py @@ -1,10 +1,3 @@ -"""Decide whether request tools name the LiteLLM MCP gateway without importing the gateway handler. - -``litellm_proxy_mcp_handler`` sits on the proxy layer and needs the optional proxy extras. The SDK entry -points ask this module first, so a base install never imports the handler for tools that do not name the -gateway: function tools, provider-hosted tools, or an MCP server the provider calls itself. -""" - import importlib import re from collections.abc import Iterable @@ -44,9 +37,6 @@ def _gateway_registry_loads() -> bool: def may_name_litellm_mcp_gateway(tools: Iterable[object] | None) -> bool: - """True when a tool names this gateway: server_url "litellm_proxy...", or an http(s) URL ending in - /mcp/ while this process can load the gateway's server registry. The handler's ``split_mcp_tools`` - then settles which of the latter the gateway actually serves, and without the registry it serves none.""" items: Final = tuple(tools or ()) if any(map(names_gateway_explicitly, items)): return True diff --git a/tests/unit/responses/mcp/test_tool_precheck.py b/tests/unit/responses/mcp/test_tool_precheck.py index 8413ddb3e99..832151ce2a6 100644 --- a/tests/unit/responses/mcp/test_tool_precheck.py +++ b/tests/unit/responses/mcp/test_tool_precheck.py @@ -1,9 +1,3 @@ -"""The SDK entry points stay off the MCP gateway handler unless a tool can name the gateway. - -The handler module sits on the proxy layer and needs the optional ``mcp`` package. A base SDK install has -neither, so ordinary tools must never make ``completion()`` or ``responses()`` import it. -""" - import json import sys from collections import deque @@ -90,7 +84,6 @@ RESPONSES_PAYLOAD: Final = { @pytest.fixture def gateway_handler_unavailable(monkeypatch: pytest.MonkeyPatch) -> None: - """Importing any gateway handler module raises, as it does on an install without proxy extras.""" for module_name in GATEWAY_HANDLER_MODULES: monkeypatch.setitem(sys.modules, module_name, None) @@ -119,7 +112,6 @@ class _FailingImport(MetaPathFinder): def gateway_registry_unavailable( request: pytest.FixtureRequest, monkeypatch: pytest.MonkeyPatch, gateway_handler_unavailable: None ) -> None: - """The gateway's server registry fails to import the ways it does on installs without the proxy extras.""" monkeypatch.delitem(sys.modules, GATEWAY_REGISTRY_MODULE, raising=False) monkeypatch.setattr(sys, "meta_path", [_FailingImport(GATEWAY_REGISTRY_MODULE, request.param), *sys.meta_path])