Skip to content

Commit e0dd37b

Browse files
loganrosenCopilot
andauthored
docs(python): clarify available_tools/excluded_tools filter all tools, not just built-ins (#1180)
Update docstrings in client.py and inline comments in session.py to accurately document that available_tools and excluded_tools apply to the full merged tool catalog (built-in, MCP, and custom tools registered via tools=), not just built-in tools. Fixes #1179 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent c22f361 commit e0dd37b

2 files changed

Lines changed: 28 additions & 8 deletions

File tree

python/copilot/client.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,8 +1238,15 @@ async def create_session(
12381238
reasoning_effort: Reasoning effort level for the model.
12391239
tools: Custom tools to register with the session.
12401240
system_message: System message configuration.
1241-
available_tools: Allowlist of built-in tools to enable.
1242-
excluded_tools: List of built-in tools to disable.
1241+
available_tools: Allowlist of tools to enable. When specified, only
1242+
these tools will be available. Applies to the full merged tool
1243+
catalog including built-in tools, MCP tools, and custom tools
1244+
registered via ``tools=``. Custom tool names must be explicitly
1245+
included or they will be hidden from the model. Takes precedence
1246+
over ``excluded_tools``.
1247+
excluded_tools: List of tools to disable. Applies to all tools
1248+
including custom tools registered via ``tools=``. Ignored if
1249+
``available_tools`` is set.
12431250
on_user_input_request: Handler for user input requests.
12441251
hooks: Lifecycle hooks for the session.
12451252
working_directory: Working directory for the session.
@@ -1531,8 +1538,15 @@ async def resume_session(
15311538
reasoning_effort: Reasoning effort level for the model.
15321539
tools: Custom tools to register with the session.
15331540
system_message: System message configuration.
1534-
available_tools: Allowlist of built-in tools to enable.
1535-
excluded_tools: List of built-in tools to disable.
1541+
available_tools: Allowlist of tools to enable. When specified, only
1542+
these tools will be available. Applies to the full merged tool
1543+
catalog including built-in tools, MCP tools, and custom tools
1544+
registered via ``tools=``. Custom tool names must be explicitly
1545+
included or they will be hidden from the model. Takes precedence
1546+
over ``excluded_tools``.
1547+
excluded_tools: List of tools to disable. Applies to all tools
1548+
including custom tools registered via ``tools=``. Ignored if
1549+
``available_tools`` is set.
15361550
on_user_input_request: Handler for user input requests.
15371551
hooks: Lifecycle hooks for the session.
15381552
working_directory: Working directory for the session.

python/copilot/session.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -847,9 +847,12 @@ class SessionConfig(TypedDict, total=False):
847847
reasoning_effort: ReasoningEffort
848848
tools: list[Tool]
849849
system_message: SystemMessageConfig # System message configuration
850-
# List of tool names to allow (takes precedence over excluded_tools)
850+
# List of tool names to allow. When specified, only these tools will be available.
851+
# Applies to the full merged tool catalog (built-in, MCP, and custom tools
852+
# registered via tools=). Takes precedence over excluded_tools.
851853
available_tools: list[str]
852-
# List of tool names to disable (ignored if available_tools is set)
854+
# List of tool names to disable. Applies to all tools including custom tools
855+
# registered via tools=. Ignored if available_tools is set.
853856
excluded_tools: list[str]
854857
# Handler for permission requests from the server
855858
on_permission_request: _PermissionHandlerFn
@@ -919,9 +922,12 @@ class ResumeSessionConfig(TypedDict, total=False):
919922
model: str
920923
tools: list[Tool]
921924
system_message: SystemMessageConfig # System message configuration
922-
# List of tool names to allow (takes precedence over excluded_tools)
925+
# List of tool names to allow. When specified, only these tools will be available.
926+
# Applies to the full merged tool catalog (built-in, MCP, and custom tools
927+
# registered via tools=). Takes precedence over excluded_tools.
923928
available_tools: list[str]
924-
# List of tool names to disable (ignored if available_tools is set)
929+
# List of tool names to disable. Applies to all tools including custom tools
930+
# registered via tools=. Ignored if available_tools is set.
925931
excluded_tools: list[str]
926932
provider: ProviderConfig
927933
# Reasoning effort level for models that support it.

0 commit comments

Comments
 (0)