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 let me verify
LCToolhas anamefield, and add a regression test: - Assistant
Now add regression tests. I'll place a new describe block after the GOOGLE_TOOL_CONFLICT test:
- Assistant
librechat-data-providerisn't built yet. Building it: - Assistant
All 39 tests pass, including the 5 new dedupe tests. Now verify TypeScript and lint:
- Assistant
The test file hits the
Agent['tools']: string[]∩GenericTool[]intersection typing. Let me fix the test assertions: - Assistant
Lint is clean. Run the broader related suites to ensure nothing regressed:
- Assistant
The fix is complete. The summarization e2e failure is pre-existing and environmental (it needs Node's
--experimental-vm-modulesflag for the SDK's tokenizer dynamic import) — it fails identically without my changes.Summary
Root cause: In
packages/api/src/agents/initialize.ts, when an agent runs on Anthropic with LibreChat web search enabled, the tool merge concatenated the LibreChat structuredweb_searchtool with the provider tools fromgetLLMConfig— which include Anthropic's native{ type: 'web_search_20250305', name: 'web_search' }when Anthropic web search is enabled (). Two tools named reached the API, which Anthropic rejects.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.