From 6a67fda42e258363ec6311ea3384597c77f6b124 Mon Sep 17 00:00:00 2001 From: Chenglun Hu Date: Thu, 18 Jun 2026 09:58:26 +0800 Subject: [PATCH] rename constant to MCP_INTERNAL_REQUEST_KEYS per review (avoid all_litellm_params name echo) --- litellm/litellm_core_utils/core_helpers.py | 6 +++--- .../test_litellm/litellm_core_utils/test_core_helpers.py | 8 ++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/litellm/litellm_core_utils/core_helpers.py b/litellm/litellm_core_utils/core_helpers.py index 1b278d518b5..94b75ff0a76 100644 --- a/litellm/litellm_core_utils/core_helpers.py +++ b/litellm/litellm_core_utils/core_helpers.py @@ -682,7 +682,7 @@ def filter_exceptions_from_params(data: object, max_depth: int = 20) -> Any: # filtering the full `all_litellm_params` (api_key/num_retries/...) would break # the call, and knobs like stream_chunk_size are read downstream (converse # streaming) so they are not internal. See #30301. -LITELLM_INTERNAL_PARAMS: set = { +MCP_INTERNAL_REQUEST_KEYS: set = { "skip_mcp_handler", "mcp_handler_context", "_skip_mcp_handler", @@ -693,7 +693,7 @@ def filter_internal_params(data: dict, additional_internal_params: set | None = """ Filter out LiteLLM internal parameters that shouldn't be sent to provider APIs. - The base set is `LITELLM_INTERNAL_PARAMS` (pure plumbing, also registered in + The base set is `MCP_INTERNAL_REQUEST_KEYS` (pure plumbing, also registered in `all_litellm_params`); callers may pass extra names via `additional_internal_params` for provider-specific knobs. @@ -707,7 +707,7 @@ def filter_internal_params(data: dict, additional_internal_params: set | None = if not isinstance(data, dict): return data - internal_params = set(LITELLM_INTERNAL_PARAMS) + internal_params = set(MCP_INTERNAL_REQUEST_KEYS) if additional_internal_params: internal_params.update(additional_internal_params) diff --git a/tests/test_litellm/litellm_core_utils/test_core_helpers.py b/tests/test_litellm/litellm_core_utils/test_core_helpers.py index 88328454b12..ec890d9fe9e 100644 --- a/tests/test_litellm/litellm_core_utils/test_core_helpers.py +++ b/tests/test_litellm/litellm_core_utils/test_core_helpers.py @@ -7,12 +7,16 @@ import pytest from litellm.litellm_core_utils.core_helpers import ( _FINISH_REASON_MAP, +<<<<<<< HEAD LITELLM_INTERNAL_PARAMS, RESPONSE_COST_HEADER, bind_budget_reservation_to_callbacks, budget_reservation_from_metadata, drop_params_env_flag, drop_params_flag, +======= + MCP_INTERNAL_REQUEST_KEYS, +>>>>>>> 8957cc20e7 (rename constant to MCP_INTERNAL_REQUEST_KEYS per review (avoid all_litellm_params name echo)) filter_internal_params, get_or_create_metadata_bucket, get_provider_response_headers_from_hidden_params, @@ -585,9 +589,9 @@ class TestFilterInternalParams: assert out == {"keep": 1} def test_registry_not_mutated_by_additional_params(self): - baseline = set(LITELLM_INTERNAL_PARAMS) + baseline = set(MCP_INTERNAL_REQUEST_KEYS) filter_internal_params({"x": 1}, additional_internal_params={"adhoc_key"}) - assert LITELLM_INTERNAL_PARAMS == baseline + assert MCP_INTERNAL_REQUEST_KEYS == baseline def test_non_dict_passes_through(self): assert filter_internal_params("not-a-dict") == "not-a-dict"