Skip to content

Commit 85cd690

Browse files
authored
enable tool search for Anthropic Messages API (microsoft#3158)
* enable tool search for Anthropic Messages API * update tests
1 parent 2051a86 commit 85cd690

File tree

4 files changed

+116
-2
lines changed

4 files changed

+116
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3443,7 +3443,7 @@
34433443
},
34443444
"github.copilot.chat.anthropic.toolSearchTool.enabled": {
34453445
"type": "boolean",
3446-
"default": false,
3446+
"default": true,
34473447
"markdownDescription": "%github.copilot.config.anthropic.toolSearchTool.enabled%",
34483448
"tags": [
34493449
"experimental",

src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-claude-opus-4.5/all_non_edit_tools.spec.snap

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,63 @@ You don't currently have any tools available for running terminal commands. If t
4141
Tools can be disabled by the user. You may see tools used previously in the conversation that are not currently available. Be careful to only use the tools that are currently available to you.
4242

4343
</toolUseInstructions>
44+
<toolSearchInstructions>
45+
Use the tool_search_tool_regex tool to search for deferred tools before calling them.
46+
47+
<mandatory>
48+
You MUST use the tool_search_tool_regex tool to load deferred tools BEFORE calling them directly.
49+
This is a BLOCKING REQUIREMENT - deferred tools listed below are NOT available until you load them using the tool_search_tool_regex tool. Once a tool appears in the results, it is immediately available to call.
50+
51+
Why this is required:
52+
- Deferred tools are not loaded until discovered via tool_search_tool_regex
53+
- Calling a deferred tool without first loading it will fail
54+
55+
</mandatory>
56+
57+
<regexPatternSyntax>
58+
Construct regex patterns using Python's re.search() syntax. Common patterns:
59+
- `^mcp__github__` - matches tools starting with "mcp__github__"
60+
- `issue|pull_request` - matches tools containing "issue" OR "pull_request"
61+
- `create.*branch` - matches tools with "create" followed by "branch"
62+
- `mcp__.*__list` - matches MCP tools ending with "list"
63+
64+
The pattern is matched case-insensitively against tool names.
65+
66+
</regexPatternSyntax>
67+
68+
<incorrectUsagePatterns>
69+
NEVER do these:
70+
- Calling a deferred tool directly without loading it first with tool_search_tool_regex
71+
- Calling tool_search_tool_regex again for a tool that was already returned by a previous search
72+
73+
</incorrectUsagePatterns>
74+
75+
<availableDeferredTools>
76+
Available deferred tools (must be loaded with tool_search_tool_regex before use):
77+
copilot_getNotebookSummary
78+
create_directory
79+
create_new_jupyter_notebook
80+
create_new_workspace
81+
edit_notebook_file
82+
get_doc_info
83+
get_project_setup_info
84+
get_search_view_results
85+
get_vscode_api
86+
github_repo
87+
install_extension
88+
open_simple_browser
89+
read_notebook_cell_output
90+
read_project_structure
91+
run_notebook_cell
92+
run_vscode_command
93+
search_subagent
94+
search_workspace_symbols
95+
test_failure
96+
test_search
97+
tool_replay
98+
</availableDeferredTools>
99+
100+
</toolSearchInstructions>
44101
<communicationStyle>
45102
Maintain clarity and directness in all responses, delivering complete information while matching response depth to the task's complexity.
46103
For straightforward queries, keep answers brief - typically a few lines excluding code or tool invocations. Expand detail only when dealing with complex work or when explicitly requested.

src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-claude-opus-4.5/all_tools.spec.snap

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,63 @@ You don't currently have any tools available for running terminal commands. If t
4040
Tools can be disabled by the user. You may see tools used previously in the conversation that are not currently available. Be careful to only use the tools that are currently available to you.
4141

4242
</toolUseInstructions>
43+
<toolSearchInstructions>
44+
Use the tool_search_tool_regex tool to search for deferred tools before calling them.
45+
46+
<mandatory>
47+
You MUST use the tool_search_tool_regex tool to load deferred tools BEFORE calling them directly.
48+
This is a BLOCKING REQUIREMENT - deferred tools listed below are NOT available until you load them using the tool_search_tool_regex tool. Once a tool appears in the results, it is immediately available to call.
49+
50+
Why this is required:
51+
- Deferred tools are not loaded until discovered via tool_search_tool_regex
52+
- Calling a deferred tool without first loading it will fail
53+
54+
</mandatory>
55+
56+
<regexPatternSyntax>
57+
Construct regex patterns using Python's re.search() syntax. Common patterns:
58+
- `^mcp__github__` - matches tools starting with "mcp__github__"
59+
- `issue|pull_request` - matches tools containing "issue" OR "pull_request"
60+
- `create.*branch` - matches tools with "create" followed by "branch"
61+
- `mcp__.*__list` - matches MCP tools ending with "list"
62+
63+
The pattern is matched case-insensitively against tool names.
64+
65+
</regexPatternSyntax>
66+
67+
<incorrectUsagePatterns>
68+
NEVER do these:
69+
- Calling a deferred tool directly without loading it first with tool_search_tool_regex
70+
- Calling tool_search_tool_regex again for a tool that was already returned by a previous search
71+
72+
</incorrectUsagePatterns>
73+
74+
<availableDeferredTools>
75+
Available deferred tools (must be loaded with tool_search_tool_regex before use):
76+
copilot_getNotebookSummary
77+
create_directory
78+
create_new_jupyter_notebook
79+
create_new_workspace
80+
edit_notebook_file
81+
get_doc_info
82+
get_project_setup_info
83+
get_search_view_results
84+
get_vscode_api
85+
github_repo
86+
install_extension
87+
open_simple_browser
88+
read_notebook_cell_output
89+
read_project_structure
90+
run_notebook_cell
91+
run_vscode_command
92+
search_subagent
93+
search_workspace_symbols
94+
test_failure
95+
test_search
96+
tool_replay
97+
</availableDeferredTools>
98+
99+
</toolSearchInstructions>
43100
<communicationStyle>
44101
Maintain clarity and directness in all responses, delivering complete information while matching response depth to the task's complexity.
45102
For straightforward queries, keep answers brief - typically a few lines excluding code or tool invocations. Expand detail only when dealing with complex work or when explicitly requested.

src/platform/configuration/common/configurationService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -855,7 +855,7 @@ export namespace ConfigKey {
855855
/** Context editing for Anthropic Messages API */
856856
export const AnthropicContextEditingEnabled = defineSetting<boolean>('chat.anthropic.contextEditing.enabled', ConfigType.ExperimentBased, false);
857857
/** Enable tool search for Anthropic Messages API (deferred tool loading). Uses BM25 for natural language search. */
858-
export const AnthropicToolSearchEnabled = defineSetting<boolean>('chat.anthropic.toolSearchTool.enabled', ConfigType.ExperimentBased, false);
858+
export const AnthropicToolSearchEnabled = defineSetting<boolean>('chat.anthropic.toolSearchTool.enabled', ConfigType.ExperimentBased, true);
859859
/** Configure reasoning effort sent to Responses API */
860860
export const ResponsesApiReasoningEffort = defineSetting<'low' | 'medium' | 'high' | 'default'>('chat.responsesApiReasoningEffort', ConfigType.ExperimentBased, 'default');
861861
/** Configure reasoning summary style sent to Responses API */

0 commit comments

Comments
 (0)