Task tool fails with 'Tool names must be unique' error when MCP servers are enabled
Resolved 💬 6 comments Opened Oct 31, 2025 by Jayyo Closed Jan 10, 2026
Bug Description
The Task tool (used for spawning sub-agents) fails with error tools: Tool names must be unique when MCP servers are enabled, specifically Playwright MCP in my case.
Steps to Reproduce
- Enable any MCP server (e.g., Playwright):
``bash``
claude mcp add playwright
- Try to use the Task tool with a sub-agent:
````
Task tool with subagent_type=Explore
- Observe the error
Expected Behavior
Task tool should work correctly even when MCP servers are enabled, with sub-agents having access to all available tools including MCP tools.
Actual Behavior
API Error: 400
{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "tools: Tool names must be unique."
}
}
Root Cause Analysis
When Task tool spawns a sub-agent:
- The sub-agent tries to load all available tools
- MCP server tools are already loaded in the parent session
- Tool names collide when the sub-agent tries to re-register them
- This causes the "Tool names must be unique" error
Workaround
Temporarily disable MCP servers:
claude mcp disable playwright
Environment
- Claude Code Version: 2.0.30 (native build)
- OS: Ubuntu 24.04.3 LTS (Linux 6.14.0-33-generic)
- MCP Server: Playwright MCP (@playwright/mcp)
- Active MCP Servers: 1 (playwright)
Additional Context
- Other tools (Glob, Grep, Read, Bash) work fine with MCP enabled
- Only Task tool is affected
- This blocks parallel multi-agent workflows when MCP is active
Suggested Fix
Sub-agents should either:
- Inherit the parent's tool registry without re-registering
- Skip duplicate tool registration with a warning
- Namespace MCP tools differently for parent/child contexts
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗