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
Now I'll implement the fix at the merge point in
packages/api/src/agents/initialize.ts: - Assistant
Workspace deps aren't built yet. Let me check and run the relevant tests directly:
- Assistant
Typecheck passes. Now run the existing tests for this file:
- Assistant
All existing tests pass. Now add tests for the new dedup behavior — let me examine the test setup:
- Assistant
Now add tests for the dedup behavior:
- Assistant
All 39 tests pass. Now verify typecheck and lint:
- Assistant
Done. The pre-existing
summarization.e2e.test.tsfailure was verified to fail without my changes too (it's a tokenizer fetch issue in the sandboxed environment, unrelated to this fix) — everything else passes.Summary
Problem: When an agent has LibreChat's
web_searchtool loaded and Anthropic-native web search enabled (via theweb_searchmodel param), both reach the model bind as tools namedweb_search—getLLMConfigemits{ type: 'web_search_20250305', name: 'web_search' }(packages/api/src/endpoints/anthropic/llm.ts:298) while the loaded LibreChat search tool carries the same name, and Anthropic rejects the request for duplicate tool names.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.