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 LibreChat and Anthropic web search tools are registered and merged so we can dedupe to a single
web_searchwith LibreChat's definition preferred. - Assistant
Implementing deduplication in agent tool merging: when LibreChat's
web_searchis loaded, filter Anthropic's nativeweb_searchfrom provider tools. - Assistant
Adding tests for the new helpers and the initialize integration.
- Assistant
When both LibreChat web search and Anthropic’s native web search are enabled, the agent was sending two tools named
web_search— LibreChat’s structured tool and Anthropic’s{ type: 'web_search_20250305', name: 'web_search' }from provider config. Anthropic rejects that duplicate.Fix
In
initializeAgent, provider tools are reconciled before merge:- Detect whether LibreChat’s
web_searchwas actually loaded (structuredToolsortoolDefinitions) - For Anthropic only, drop the native
web_search_20250305entry when LibreChat’s version is present - Leave other provider tools and non-Anthropic providers unchanged
Helpers live in
packages/api/src/agents/tools.ts:hasLibreChatWebSearch— checks loaded LibreChat toolsisAnthropicNativeWebSearchTool— identifies the native Anthropic shapereconcileAnthropicProviderTools— filters provider tools when needed
Behavior
Scenario Result - Detect whether 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.