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 find where Anthropic and LibreChat web search tools are registered and merged so we can dedupe to a single
web_searchwith LibreChat's definition preferred. - Assistant
Implementing deduplication in the Anthropic provider-tools merge path and adding tests.
- Assistant
Fixed the duplicate
web_searchissue when both LibreChat web search and Anthropic-native web search are enabled.Cause
In
initializeAgent, Anthropic provider tools fromgetLLMConfigwere merged with LibreChat agent tools without deduplication. When both were on, the request included:- LibreChat's
web_searchstructured tool - Anthropic's
{ type: 'web_search_20250305', name: 'web_search' }
Anthropic rejects duplicate tool names.
Fix
Added
filterAnthropicProviderToolsForWebSearchinpackages/api/src/endpoints/anthropic/tools.tsthat:- Detects when LibreChat
web_searchis loaded (structured tool or tool definition) - Filters out Anthropic's native
web_searchfrom provider tools before merging - Leaves other provider tools and non-Anthropic providers unchanged
- LibreChat's
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.