Anthropic rejects duplicate websearch tool names When LibreChat web search and…
- User
Anthropic rejects duplicate web_search tool names
When LibreChat web search and Anthropic-native web search are both enabled, expose one
web_searchtool and prefer LibreChat's definition. Do not affect unrelated tools or other providers.Interface
No new public interfaces are introduced.
- Assistant
I'll locate where LibreChat and Anthropic web search tools are registered so we can dedupe to a single
web_searchdefinition. - Assistant
Implementing deduplication helpers and updating agent initialization to prefer LibreChat's
web_searchwhen both are enabled. - Assistant
When both LibreChat web search and Anthropic's native
web_searchare enabled, agent initialization now exposes a singleweb_searchtool and keeps LibreChat's definition.Cause
initializeAgentmerged provider-native tools (web_search_20250305) with LibreChat's loadedweb_searchtool, so Anthropic received two tools with the same name.Fix
In
packages/api/src/agents/initialize.ts, provider tools are filtered before merge when LibreChat'sweb_searchis already loaded (viastructuredToolsortoolDefinitions). Helpers inpackages/api/src/agents/tools.ts:isAnthropicNativeWebSearchTool— identifies Anthropic's native tool by shape (type: 'web_search_20250305')agentHasLibreChatWebSearch— checks whether LibreChat's tool is loadedexcludeAnthropicNativeWebSearch— drops the native tool when LibreChat's is present
Behavior
Scenario Result Both enabled
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.