[BUG] "Tool names must be unique" error after MCP server reconnection via /mcp
Resolved 💬 3 comments Opened Dec 16, 2025 by forkni Closed Dec 20, 2025
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
After reconnecting to an MCP server via /mcp → Reconnect, subsequent operations like /compact fail with error:
Error: API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"tools: Tool names must be unique."}}
This error does NOT occur:
- On initial connection
- When MCP server is disconnected
- Before reconnection
## Environment
- Claude Code Version: 2.0.70
- OS: Windows 11
- MCP Server: Custom stdio server with 17 tools (verified no duplicates in server code)
What Should Happen?
Reconnection should clear the previous tool registration before re-registering tools from the MCP server.
Error Messages/Logs
Error: API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"tools: Tool names must be unique."}}
Steps to Reproduce
- Start Claude Code in a project with MCP server configured
- MCP server connects successfully (tools available)
- Run
/mcp - Select the MCP server → Reconnect
- Run
/compact(or wait for auto-compact) - Error occurs: "tools: Tool names must be unique"
Claude Model
Sonnet (default)
Is this a regression?
Yes, this worked in a previous version
Last Working Version
2.0.65
Claude Code Version
2.0.70
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗