claude-code
claude-code copied to clipboard
/compact fails with "tools: Tool names must be unique" error when using multiple MCP servers (v2.0.70)
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?
When running /compact command after using MCP tools, it fails with the following error:
Error: Error during compaction: Error: API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"tools: Tool names must be unique"},"request_id":"req_011CWA8bntCcJpqrx7YyiUXN"}
Environment:
- Version: 2.0.70
- OS: Windows 11 (MINGW64)
- MCP servers: 6 (supabase, context7, shadcn, vercel, cloudflare-workers, chrome-devtools)
Notes:
-
/mcp listshows no duplicate servers - Error occurs consistently after using MCP tools (especially chrome-devtools)
- Starting a new conversation and running
/compactalso fails - Removed duplicate MCP configs from .claude.json but issue persists
- This was supposedly fixed in v2.0.31 but still occurs in v2.0.70
What Should Happen?
/compact should successfully compact the conversation context without errors, even when multiple MCP servers are connected and MCP tools have been used in the conversation.
Error Messages/Logs
Steps to Reproduce
- Connect 6 MCP servers (supabase, context7, shadcn, vercel, cloudflare-workers, chrome-devtools)
- Start a new conversation
- Use an MCP tool (e.g., chrome-devtools fill command)
- When "Context low" warning appears, run
/compact - Error occurs: "tools: Tool names must be unique"
Claude Model
Opus
Is this a regression?
No, this never worked
Last Working Version
No response
Claude Code Version
2.0.70
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
No response