MCP tool calls duplicated multiple times when using parallel subagents
Resolved 💬 2 comments Opened Feb 3, 2026 by CarlJi Closed Feb 3, 2026
Bug Description
When using multiple parallel subagents (Task tool) to review code, the same MCP tool call is executed multiple times (observed 4x duplicate calls for a single intended operation). This causes duplicate comments/actions on external services.
Reproduction Steps
- Launch multiple parallel subagents using the Task tool for code review
- Each subagent attempts to call an MCP tool (e.g.,
github-comments_create_inline_comment) - Observe that the same tool call is sent multiple times
Evidence / Logs
The following log shows the same tool call being sent 4 times with identical parameters:
{
"type": "assistant",
"message": {
"id": "msg_c8b67bb114784db4891e6d9e404ef819",
"type": "message",
"role": "assistant",
"content": [
{
"type": "tool_use",
"id": "tooluse_2i5TnFpbTaqULWa2KwGATA",
"name": "mcp__codeagent__github-comments_create_inline_comment",
"input": {
"pr_number": "1256",
"path": "boss/src/pages/ailog/components/tool-viewers/EnvSetupViewer.tsx",
"line": "22",
"side": "RIGHT",
"body": "<!-- codeagent-review-id: pr-1256 -->\n\n**[代码重复]** ..."
}
}
],
"stop_reason": null,
...
},
"session_id": "7859ab69-1d28-4280-a2ba-4e776b5de500",
"uuid": "978b20fa-2ead-4d23-b8fa-a321b64e6f87" // Different UUID each time
}
Key observations:
- Same
tool_use.id:tooluse_2i5TnFpbTaqULWa2KwGATA - Same
message.id:msg_c8b67bb114784db4891e6d9e404ef819 - Same parameters (pr_number, path, line, body)
- Different
uuidfor each message (4 different UUIDs) stop_reason: nullon all messages
Expected Behavior
Each MCP tool call should be executed exactly once.
Actual Behavior
The same MCP tool call is executed 4 times, resulting in duplicate comments on GitHub PRs.
Related Issues
- #21941 - Subagents complete multiple times (same root cause suspected)
- #14253 - Messages sent during Task agent execution are delivered twice
- #21906 - tool_result blocks in wrong order for parallel tool calls
Environment
- Platform: macOS (darwin)
- Use case: Parallel subagents for PR code review with custom MCP server
Workaround
Currently using deduplication on the MCP server side based on tool_use_id, but this should be handled at the Claude Code level.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗