[BUG] - Task tool fails with "Tool names must be unique" when MCP servers are configured - Agents and MCP are mutually exclusive

Resolved 💬 4 comments Opened Mar 5, 2026 by JaimePolo360 Closed Apr 3, 2026

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?

The Task tool for agent delegation fails 100% of the time when MCP (Model Context Protocol) servers are configured. This makes it impossible to use both MCP servers and agent delegation together, forcing users to choose between these two fundamental features.

Environment

  • Claude Code Version: Current (March 2026)
  • Operating System: macOS Darwin 25.3.0
  • MCP Servers: 11 configured (terraform-state, filesystem, memory, aws-documentation, aws-iac, aws-terraform, aws-cloudformation, aws-ecs, aws-serverless)
  • Configuration File: ~/Library/Application Support/Claude/claude_desktop_config.json

What Should Happen?

Agent delegation via the Task tool should work regardless of MCP server configuration. Both features are core to Claude Code's functionality and should be compatible. Users should be able to:

  1. Have MCP servers configured for integrations
  2. Use Task tool to delegate work to agents
  3. Run both features simultaneously without conflicts

Error Messages/Logs

API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"tools: Tool names must be unique."},"request_id":"req_011CYk9wks9xKjeZqAzNmrsP"}


This error occurs on EVERY attempt to use the Task tool when MCP servers are present, including:
- Custom agents defined in `~/.claude/agents/`
- Built-in agents (general-purpose, Explore, Plan)
- Regardless of agent configuration or frontmatter

Steps to Reproduce

  1. Configure MCP servers in ~/Library/Application Support/Claude/claude_desktop_config.json:
{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path"]
    },
    "memory": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-memory"]
    }
  }
}
  1. Start Claude Code with the MCP configuration
  1. Attempt to use Task tool with any agent:
Task(
    subagent_type="general-purpose",
    description="Test task",
    prompt="Simple test prompt"
)
  1. Observe the error - fails immediately with "Tool names must be unique"
  1. Verify workaround - Disable all MCP servers ("mcpServers": {}) and restart Claude Code - agents now work

Claude Model

Not sure / Multiple models

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.0.30 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

Additional Testing Performed

Tested multiple configurations, all failed with the same error:

  • ✅ Tested with built-in agents (general-purpose, Explore)
  • ✅ Tested with custom agents in ~/.claude/agents/
  • ✅ Tested with proper YAML frontmatter as per documentation
  • ✅ Tested with explicit tools: specification
  • ✅ Tested with disallowedTools: specification
  • ✅ Tested without any tools specification

Result: 100% failure rate when MCP servers are configured

Impact

This bug forces users to choose between:

  • Option A: Keep MCP servers → Lose all agent delegation capabilities
  • Option B: Disable MCP servers → Lose all integrations and persistent memory

For users with complex workflows requiring both features (like infrastructure automation with Terraform MCP servers + parallel agent processing), this makes Claude Code significantly less effective.

Root Cause

The Task tool appears to merge tools from parent and agent without deduplication:

  1. Parent process has: [Read, Write, Bash, mcp_tool1, mcp_tool2, ...]
  2. Agent inherits: [Read, Write, Bash, ...]
  3. Merged array contains: [Read, Read, Write, Write, ...] (duplicates)
  4. API rejects the request due to duplicate tool names

Related Issues

  • #10668 - Original report from Oct 2025 (marked "Completed" but not fixed)
  • #11028 - Detailed report from Nov 2025 (auto-closed after 60 days)
  • Multiple other reports: #10704, #10708, #14111

Proposed Fix

The immediate fix would be to deduplicate tool names before sending to the API. A better architectural fix would be to properly namespace tools or not duplicate inherited tools in the first place.

---

Note: This is not a duplicate issue. Previous reports were auto-closed without resolution, and the bug persists in the current version. The workaround of disabling all MCP servers is not acceptable for production use.%

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗