Clarify allowed_tools docstring: None vs [] semantics

Per Eduard's review on PR #6296: explicitly document that None exposes all tools and [] exposes none, across all four MCPTool / MCPStdioTool / MCPStreamableHTTPTool / MCPWebsocketTool docstrings.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Chetan Toshniwal
2026-06-08 19:13:26 -07:00
Unverified
parent f15faab6d3
commit 20b50ed050
+20 -4
View File
@@ -228,7 +228,11 @@ class MCPTool:
name: The name of the MCP tool.
description: A description of the MCP tool.
approval_mode: Whether approval is required to run tools.
allowed_tools: A collection of tool names to allow.
allowed_tools: Optional allow-list of MCP tool names to expose as functions.
``None`` (the default) exposes every tool advertised by the MCP server.
An empty collection (``[]``) exposes no tools, which is useful when the
server is being used only for prompts or other capabilities. A non-empty
collection exposes only the tools whose names appear in it.
tool_name_prefix: Optional prefix to prepend to exposed MCP function names.
load_tools: Whether to load tools from the MCP server.
parse_tool_results: An optional callable with signature
@@ -1592,7 +1596,11 @@ class MCPStdioTool(MCPTool):
- A dict with keys `always_require_approval` or `never_require_approval`,
followed by a sequence of strings with the names of the relevant tools.
A tool should not be listed in both, if so, it will require approval.
allowed_tools: A list of tools that are allowed to use this tool.
allowed_tools: Optional allow-list of MCP tool names to expose as functions.
``None`` (the default) exposes every tool advertised by the MCP server.
An empty collection (``[]``) exposes no tools, which is useful when the
server is being used only for prompts or other capabilities. A non-empty
collection exposes only the tools whose names appear in it.
additional_properties: Additional properties.
args: The arguments to pass to the command.
env: The environment variables to set for the command.
@@ -1726,7 +1734,11 @@ class MCPStreamableHTTPTool(MCPTool):
- A dict with keys `always_require_approval` or `never_require_approval`,
followed by a sequence of strings with the names of the relevant tools.
A tool should not be listed in both, if so, it will require approval.
allowed_tools: A list of tools that are allowed to use this tool.
allowed_tools: Optional allow-list of MCP tool names to expose as functions.
``None`` (the default) exposes every tool advertised by the MCP server.
An empty collection (``[]``) exposes no tools, which is useful when the
server is being used only for prompts or other capabilities. A non-empty
collection exposes only the tools whose names appear in it.
additional_properties: Additional properties.
terminate_on_close: Close the transport when the MCP client is terminated.
client: The chat client to use for sampling.
@@ -1901,7 +1913,11 @@ class MCPWebsocketTool(MCPTool):
- A dict with keys `always_require_approval` or `never_require_approval`,
followed by a sequence of strings with the names of the relevant tools.
A tool should not be listed in both, if so, it will require approval.
allowed_tools: A list of tools that are allowed to use this tool.
allowed_tools: Optional allow-list of MCP tool names to expose as functions.
``None`` (the default) exposes every tool advertised by the MCP server.
An empty collection (``[]``) exposes no tools, which is useful when the
server is being used only for prompts or other capabilities. A non-empty
collection exposes only the tools whose names appear in it.
additional_properties: Additional properties.
client: The chat client to use for sampling.
kwargs: Any extra arguments to pass to the WebSocket client.