Skip to content

Remove server-side tool search and consolidate on client-side tool_search#310343

Merged
bhavyaus merged 1 commit intomainfrom
dev/bhavyau/remove-server-tool-search
Apr 16, 2026
Merged

Remove server-side tool search and consolidate on client-side tool_search#310343
bhavyaus merged 1 commit intomainfrom
dev/bhavyau/remove-server-tool-search

Conversation

@bhavyaus
Copy link
Copy Markdown
Collaborator

@bhavyaus bhavyaus commented Apr 15, 2026

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).

Copilot AI review requested due to automatic review settings April 15, 2026 23:43
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 15, 2026

Screenshot Changes

Base: f58e28cd Current: 9851a2c1

Changed (3)

chat/aiCustomizations/aiCustomizationManagementEditor/McpBrowseMode/Light
Before After
before after
chat/aiCustomizations/aiCustomizationManagementEditor/McpBrowseMode/Dark
Before After
before after
editor/inlineCompletions/other/JumpToHint/Dark
Before After
before after

blocks-ci screenshots changed

Replace the contents of test/componentFixtures/blocks-ci-screenshots.md with:

Updated blocks-ci-screenshots.md
<!-- auto-generated by CI — do not edit manually -->

#### editor/codeEditor/CodeEditor/Dark
![screenshot](https://hediet-screenshots.azurewebsites.net/images/cb32a3e854b5734fe5aaca2318f2e0a42ee821b05ea97883ea42c5ba95edb3c3)

#### editor/codeEditor/CodeEditor/Light
![screenshot](https://hediet-screenshots.azurewebsites.net/images/42624fbba5e0db7f32c224b5eb9c5dd3b08245697ae2e7d2a88be0d7c287129b)

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 modelSupportsToolSearch to parse Claude Sonnet/Opus versions (>= 4.5), and updated endpoints/headers to gate on supportsToolSearch.
  • Updated tool registration and prompt/snapshot expectations to use tool_search with 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 the tool_search tool is actually enabled/present. This can render instructions that reference an unavailable tool. Consider gating on availableTools containing CUSTOM_TOOL_SEARCH_NAME as 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

  • toolSearchEnabled is derived only from endpoint.supportsToolSearch, but the tool_search tool can be disabled and therefore not available in the request. In that case this reminder will instruct the model to call tool_search even though it isn’t enabled. Consider gating this on the tool actually being present/enabled (e.g. by checking availableTools/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

  • toolSearchEnabled is derived solely from endpoint.supportsToolSearch, but tool search also requires the client-side tool_search tool to actually be present in options.requestOptions.tools (it can be disabled via tool picker). As-is, we can mark many tools defer_loading: true even when tool_search isn'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 of CUSTOM_TOOL_SEARCH_NAME in the request tool list (and treating it as disabled otherwise).
  • Files reviewed: 41/41 changed files
  • Comments generated: 4

Comment thread extensions/copilot/src/extension/tools/node/toolSearchTool.ts
Comment thread extensions/copilot/src/extension/prompt/node/chatMLFetcher.ts
…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
@bhavyaus bhavyaus force-pushed the dev/bhavyau/remove-server-tool-search branch from 769c962 to 6d7d39b Compare April 16, 2026 00:36
@bhavyaus bhavyaus enabled auto-merge (squash) April 16, 2026 00:44
@bhavyaus bhavyaus merged commit d75a407 into main Apr 16, 2026
25 of 26 checks passed
@bhavyaus bhavyaus deleted the dev/bhavyau/remove-server-tool-search branch April 16, 2026 00:59
@vs-code-engineering vs-code-engineering bot added this to the 1.117.0 milestone Apr 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants