Skip to content

Commit 09f7020

Browse files
Use all tools unless explicit allowed_tools (#3397)
Co-authored-by: célina <[email protected]>
1 parent 213bd3d commit 09f7020

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/huggingface_hub/inference/_mcp/mcp_client.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ async def add_mcp_server(self, type: ServerType, **params: Any):
158158
from mcp import types as mcp_types
159159

160160
# Extract allowed_tools configuration if provided
161-
allowed_tools = params.pop("allowed_tools", [])
161+
allowed_tools = params.pop("allowed_tools", None)
162162

163163
# Determine server type and create appropriate parameters
164164
if type == "stdio":
@@ -218,9 +218,10 @@ async def add_mcp_server(self, type: ServerType, **params: Any):
218218
logger.debug("Connected to server with tools:", [tool.name for tool in response.tools])
219219

220220
# Filter tools based on allowed_tools configuration
221-
filtered_tools = [tool for tool in response.tools if tool.name in allowed_tools]
221+
filtered_tools = response.tools
222222

223-
if allowed_tools:
223+
if allowed_tools is not None:
224+
filtered_tools = [tool for tool in response.tools if tool.name in allowed_tools]
224225
logger.debug(
225226
f"Tool filtering applied. Using {len(filtered_tools)} of {len(response.tools)} available tools: {[tool.name for tool in filtered_tools]}"
226227
)

0 commit comments

Comments
 (0)