ISSUE DESCRIPTION Anthropic rejects duplicate websearch tool names When LibreChat web…
- User
ISSUE DESCRIPTION
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.
ADDITIONAL ADVICE
Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use
git checkout <file>to restore the file to its original state. You can also reset all changes in the repository usinggit reset --hardcommand. Additionally, you can usegit stashandgit stash popto temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you callsubmit) usinggit statusorgit diffcommands. However you don't need to usegit addorgit commitbefore submitting your changes. In fact,submitonly submits currently unstaged changes because it usesgit diffto get the changes that need to be submitted.CHECKLIST
Before submitting your solution, please go over the following checklist and make sure you've done everything:
- If an error was reported in the issue description, I have successfully reproduced it.
- If an error was reported in the issue description, I have confirmed that my fix resolves the error.
- I have thought about edge cases and made sure my fix handles them as well.
- I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.
Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!
(Current directory: /LibreChat, current file: none) bash-$
- Assistant
I’ll trace tool construction and provider-specific request handling, identify where LibreChat and Anthropic web-search tools are combined, then make the smallest provider-scoped deduplication change. I’ll inspect relevant tests and run focused validation without modifying tests.
- Assistant
The duplicate is introduced in agent initialization: Anthropic’s provider configuration supplies the native
{type: ..., name: 'web_search'}inoptions.tools, while LibreChat’s loaded structured tool is prepended during the Anthropic merge. I’ll filter only the provider-configured Anthropic entry when a LibreChatweb_searchalready exists, preserving all other tools and provider paths. - Assistant
The source change is formatted and scoped correctly. Full TypeScript validation is blocked by the repository’s existing unresolved workspace package imports, and the focused Jest invocation cannot parse this mixed workspace setup before running tests; neither failure points to the changed code. I’ll do a final diff/status review and confirm only the intended source file is part of my change (leaving the pre-existing package metadata edits untouched).
- Assistant
Implemented the Anthropic web-search deduplication.
- Added Anthropic-specific tool merging logic.
- When LibreChat’s
web_searchtool is present, the Anthropic-native duplicate is removed. - LibreChat’s definition is retained.
- Other tools and providers remain unchanged.
- Pre-existing
package.jsonandpackage-lock.jsonmodifications were left untouched.
Validation:
- Prettier check passed.
git diff --checkpassed.- TypeScript validation was blocked by existing unresolved workspace package imports.
- Focused Jest execution was blocked by the repository’s workspace parser configuration before tests ran.
Checklist:
- Reproduced the reported issue conceptually by tracing the merge: LibreChat and Anthropic both contributed
web_search. - Confirmed the fix removes only the duplicate Anthropic definition and preserves LibreChat’s version.
- Considered edge cases: no LibreChat search tool, unrelated tools, and non-Anthropic providers.
- Ran available formatting and diff validation; broader tests were blocked by existing repository setup issues.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.