Remove server-side tool search and consolidate on client-side tool_search#310343
Merged
Remove server-side tool search and consolidate on client-side tool_search#310343
Conversation
Contributor
Screenshot ChangesBase: Changed (3)blocks-ci screenshots changedReplace the contents of Updated blocks-ci-screenshots.md<!-- auto-generated by CI — do not edit manually -->
#### editor/codeEditor/CodeEditor/Dark

#### editor/codeEditor/CodeEditor/Light
 |
Contributor
There was a problem hiding this comment.
Pull request overview
Consolidates Anthropic tool-search behavior onto the client-side embeddings-based tool_search tool by removing the legacy server-side tool_search_tool_regex plumbing, settings, and stream handling. This simplifies the Messages API integration and standardizes prompts/tooling across Claude models that support deferred tool loading.
Changes:
- Removed server-side Anthropic tool-search types, settings, constants, and stream parsing/telemetry for
tool_search_tool_regex. - Refactored
modelSupportsToolSearchto parse Claude Sonnet/Opus versions (>= 4.5), and updated endpoints/headers to gate onsupportsToolSearch. - Updated tool registration and prompt/snapshot expectations to use
tool_searchwith semantic search guidance.
Show a summary per file
| File | Description |
|---|---|
| extensions/copilot/src/platform/networking/common/anthropic.ts | Removes server-side tool-search types/constants and config-based enablement helpers; keeps tool_search constant. |
| extensions/copilot/src/platform/endpoint/test/node/mockEndpoint.ts | Sets supportsToolSearch in test endpoint based on modelSupportsToolSearch. |
| extensions/copilot/src/platform/endpoint/test/node/chatModelCapabilities.spec.ts | Adds unit tests for version-parsing behavior of modelSupportsToolSearch. |
| extensions/copilot/src/platform/endpoint/node/messagesApi.ts | Removes server-side tool-search stream handling and switches request construction to rely on supportsToolSearch. |
| extensions/copilot/src/platform/endpoint/node/chatEndpoint.ts | Gates Anthropic beta header advanced-tool-use-2025-11-20 on supportsToolSearch. |
| extensions/copilot/src/platform/endpoint/common/chatModelCapabilities.ts | Replaces prefix list with regex version parsing for Claude Sonnet/Opus >= 4.5. |
| extensions/copilot/src/platform/configuration/common/configurationService.ts | Removes Anthropic tool-search settings keys. |
| extensions/copilot/src/extension/tools/node/toolSearchTool.ts | Updates model filter for registering the tool_search tool (now using family selectors). |
| extensions/copilot/src/extension/prompts/node/agent/test/summarization.spec.tsx | Removes test case that referenced server-side tool_search_tool_regex. |
| extensions/copilot/src/extension/prompts/node/agent/test/snapshots/agentPrompts-claude-sonnet-4.6/all_tools.spec.snap | Updates prompt snapshot to instruct tool_search semantic search instead of regex tool. |
| extensions/copilot/src/extension/prompts/node/agent/test/snapshots/agentPrompts-claude-sonnet-4.6/all_non_edit_tools.spec.snap | Updates prompt snapshot to instruct tool_search semantic search instead of regex tool. |
| extensions/copilot/src/extension/prompts/node/agent/test/snapshots/agentPrompts-claude-sonnet-4.5/tool_use.spec.snap | Updates reminder/tool-use snapshot from tool_search_tool_regex to tool_search. |
| extensions/copilot/src/extension/prompts/node/agent/test/snapshots/agentPrompts-claude-sonnet-4.5/simple_case.spec.snap | Updates reminder snapshot from tool_search_tool_regex to tool_search. |
| extensions/copilot/src/extension/prompts/node/agent/test/snapshots/agentPrompts-claude-sonnet-4.5/one_attachment.spec.snap | Updates reminder snapshot from tool_search_tool_regex to tool_search. |
| extensions/copilot/src/extension/prompts/node/agent/test/snapshots/agentPrompts-claude-sonnet-4.5/omit_base_agent_instructions.spec.snap | Updates reminder snapshot from tool_search_tool_regex to tool_search. |
| extensions/copilot/src/extension/prompts/node/agent/test/snapshots/agentPrompts-claude-sonnet-4.5/edited_file_events_grouped_by_kind.spec.snap | Updates reminder snapshot from tool_search_tool_regex to tool_search. |
| extensions/copilot/src/extension/prompts/node/agent/test/snapshots/agentPrompts-claude-sonnet-4.5/custom_instructions_not_in_system_message.spec.snap | Updates reminder snapshot from tool_search_tool_regex to tool_search. |
| extensions/copilot/src/extension/prompts/node/agent/test/snapshots/agentPrompts-claude-sonnet-4.5/cache_BPs_multi_round.spec.snap | Updates reminder snapshots from tool_search_tool_regex to tool_search. |
| extensions/copilot/src/extension/prompts/node/agent/test/snapshots/agentPrompts-claude-sonnet-4.5/cache_BPs.spec.snap | Updates reminder snapshot from tool_search_tool_regex to tool_search. |
| extensions/copilot/src/extension/prompts/node/agent/test/snapshots/agentPrompts-claude-sonnet-4.5/all_tools.spec.snap | Updates full tool-search instructions snapshot to tool_search semantic guidance. |
| extensions/copilot/src/extension/prompts/node/agent/test/snapshots/agentPrompts-claude-sonnet-4.5/all_non_edit_tools.spec.snap | Updates non-edit tool-search instructions snapshot to tool_search semantic guidance. |
| extensions/copilot/src/extension/prompts/node/agent/test/snapshots/agentPrompts-claude-opus-4.6/all_tools.spec.snap | Updates prompt snapshot to instruct tool_search semantic search instead of regex tool. |
| extensions/copilot/src/extension/prompts/node/agent/test/snapshots/agentPrompts-claude-opus-4.6/all_non_edit_tools.spec.snap | Updates prompt snapshot to instruct tool_search semantic search instead of regex tool. |
| extensions/copilot/src/extension/prompts/node/agent/test/snapshots/agentPrompts-claude-opus-4.5/tool_use.spec.snap | Updates reminder/tool-use snapshot from tool_search_tool_regex to tool_search. |
| extensions/copilot/src/extension/prompts/node/agent/test/snapshots/agentPrompts-claude-opus-4.5/simple_case.spec.snap | Updates reminder snapshot from tool_search_tool_regex to tool_search. |
| extensions/copilot/src/extension/prompts/node/agent/test/snapshots/agentPrompts-claude-opus-4.5/one_attachment.spec.snap | Updates reminder snapshot from tool_search_tool_regex to tool_search. |
| extensions/copilot/src/extension/prompts/node/agent/test/snapshots/agentPrompts-claude-opus-4.5/omit_base_agent_instructions.spec.snap | Updates reminder snapshot from tool_search_tool_regex to tool_search. |
| extensions/copilot/src/extension/prompts/node/agent/test/snapshots/agentPrompts-claude-opus-4.5/edited_file_events_grouped_by_kind.spec.snap | Updates reminder snapshot from tool_search_tool_regex to tool_search. |
| extensions/copilot/src/extension/prompts/node/agent/test/snapshots/agentPrompts-claude-opus-4.5/custom_instructions_not_in_system_message.spec.snap | Updates reminder snapshot from tool_search_tool_regex to tool_search. |
| extensions/copilot/src/extension/prompts/node/agent/test/snapshots/agentPrompts-claude-opus-4.5/cache_BPs_multi_round.spec.snap | Updates reminder snapshots from tool_search_tool_regex to tool_search. |
| extensions/copilot/src/extension/prompts/node/agent/test/snapshots/agentPrompts-claude-opus-4.5/cache_BPs.spec.snap | Updates reminder snapshot from tool_search_tool_regex to tool_search. |
| extensions/copilot/src/extension/prompts/node/agent/test/snapshots/agentPrompts-claude-opus-4.5/all_tools.spec.snap | Updates full tool-search instructions snapshot to tool_search semantic guidance. |
| extensions/copilot/src/extension/prompts/node/agent/test/snapshots/agentPrompts-claude-opus-4.5/all_non_edit_tools.spec.snap | Updates non-edit tool-search instructions snapshot to tool_search semantic guidance. |
| extensions/copilot/src/extension/prompts/node/agent/anthropicPrompts.tsx | Consolidates prompts to use tool_search and semantic search guidance; removes regex instructions. |
| extensions/copilot/src/extension/prompt/node/defaultIntentRequestHandler.ts | Switches enablement checks to endpoint.supportsToolSearch for tool-search-related behavior. |
| extensions/copilot/src/extension/prompt/node/chatMLFetcher.ts | Uses endpoint.supportsToolSearch to bypass tool-count hard limit. |
| extensions/copilot/src/extension/intents/node/agentIntent.ts | Enables tool_search tool based on supportsToolSearch and updates capability wiring. |
| extensions/copilot/src/extension/conversation/vscode-node/languageModelAccess.ts | Uses supportsToolSearch to bypass tool-count hard limit and removes config dependency. |
| extensions/copilot/src/extension/byok/vscode-node/anthropicProvider.ts | Removes server-side tool-search tool injection and stream parsing; gates on client tool_search presence. |
| extensions/copilot/package.nls.json | Removes localization strings for deleted Anthropic tool-search settings. |
| extensions/copilot/package.json | Removes deleted Anthropic tool-search configuration schema entries. |
Copilot's findings
Comments suppressed due to low confidence (3)
extensions/copilot/src/extension/prompts/node/agent/anthropicPrompts.tsx:341
- Same issue as above in the optimized prompt: tool-search guidance is gated only on
endpoint.supportsToolSearch/modelSupportsToolSearch, not on whether thetool_searchtool is actually enabled/present. This can render instructions that reference an unavailable tool. Consider gating onavailableToolscontainingCUSTOM_TOOL_SEARCH_NAMEas well.
const endpoint = sizing.endpoint as IChatEndpoint | undefined;
const toolSearchEnabled = endpoint
? !!endpoint.supportsToolSearch
: modelSupportsToolSearch(this.props.modelFamily ?? '');
if (!toolSearchEnabled || !this.props.availableTools) {
return;
extensions/copilot/src/extension/prompts/node/agent/anthropicPrompts.tsx:607
toolSearchEnabledis derived only fromendpoint.supportsToolSearch, but thetool_searchtool can be disabled and therefore not available in the request. In that case this reminder will instruct the model to calltool_searcheven though it isn’t enabled. Consider gating this on the tool actually being present/enabled (e.g. by checkingavailableTools/tool deferral state) rather than only on endpoint capability.
async render(state: void, sizing: PromptSizing) {
const toolSearchEnabled = !!this.props.endpoint.supportsToolSearch;
const contextEditingEnabled = isAnthropicContextEditingEnabled(this.props.endpoint, this.configurationService, this.experimentationService);
return <>
{getEditingReminder(this.props.hasEditFileTool, this.props.hasReplaceStringTool, false /* useStrongReplaceStringHint */, this.props.hasMultiReplaceStringTool)}
Do NOT create a new markdown file to document each change or summarize your work unless specifically requested by the user.<br />
{contextEditingEnabled && <>
<br />
IMPORTANT: Do NOT view your memory directory before every task. Do NOT assume your context will be interrupted or reset. Your context is managed automatically — you do not need to urgently save progress to memory. Only use memory as described in the memoryInstructions section. Do not create memory files to record routine progress or status updates unless the user explicitly asks you to.<br />
</>}
{toolSearchEnabled && <>
<br />
IMPORTANT: Before calling any deferred tool that was not previously returned by {CUSTOM_TOOL_SEARCH_NAME}, you MUST first use {CUSTOM_TOOL_SEARCH_NAME} to load it. Calling a deferred tool without first loading it will fail. Tools returned by {CUSTOM_TOOL_SEARCH_NAME} are automatically expanded and immediately available - do not search for them again.<br />
extensions/copilot/src/platform/endpoint/node/messagesApi.ts:112
toolSearchEnabledis derived solely fromendpoint.supportsToolSearch, but tool search also requires the client-sidetool_searchtool to actually be present inoptions.requestOptions.tools(it can be disabled via tool picker). As-is, we can mark many toolsdefer_loading: trueeven whentool_searchisn't available, which will make deferred tools impossible to load and can also affect tool_reference filtering. Consider gating tool search/deferral on both model capability and presence ofCUSTOM_TOOL_SEARCH_NAMEin the request tool list (and treating it as disabled otherwise).
- Files reviewed: 41/41 changed files
- Comments generated: 4
roblourens
approved these changes
Apr 15, 2026
…arch - Remove all server-side tool_search_tool_regex types, handlers, and stream processing from messagesApi.ts - Remove isAnthropicToolSearchEnabled/isAnthropicCustomToolSearchEnabled functions - Remove AnthropicToolSearchEnabled and AnthropicToolSearchMode settings - Remove TOOL_SEARCH_TOOL_NAME, TOOL_SEARCH_TOOL_TYPE, TOOL_SEARCH_SUPPORTED_MODELS constants - Refactor modelSupportsToolSearch to use version parsing instead of prefix list - Add models filter to ToolSearchTool registration for Claude Sonnet/Opus 4.5+ - Fix MockEndpoint to derive supportsToolSearch from model family - Gate advanced-tool-use beta header directly on endpoint.supportsToolSearch - Update prompts to use client-side tool_search name and semantic search instructions - Update 24 snapshot files to reflect new tool name and instructions
769c962 to
6d7d39b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Remove all server-side Anthropic tool search (
tool_search_tool_regex) code and consolidate on the client-side embeddings-based tool search (tool_search).