style(sdk): drop docstrings from the MCP gateway pre-check and its tests

This commit is contained in:
mateo-berri 2026-10-19 16:06:07 -07:00
parent 2dc89c7f64
commit e280439629
2 changed files with 0 additions and 18 deletions

View file

@ -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/<name> 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

View file

@ -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])