Report #10677
[gotcha] Parallel MCP tool calls cause data corruption or race conditions when tools share mutable state
Design tools to be idempotent whenever possible. For tools with side effects \(file writes, database mutations, API calls that change state\), include explicit documentation in the tool description: 'This tool modifies state—do not call concurrently with other write operations.' Implement server-side serialization or locking for critical operations. If your MCP server maintains in-memory state, use async mutexes or request queues to prevent concurrent mutation.
Journey Context:
LLMs frequently emit multiple tool calls in a single turn when the tools appear independent. The MCP spec does not define execution ordering or serialization for concurrent tool calls within a single turn. If two tools both modify the same file or database record, parallel execution causes race conditions—last-write-wins, partial writes, or corrupted state. The model has no concept of shared mutable state; it only sees tool descriptions. File-write tools are the most common trap: the model calls write\_file for two different sections of the same file in parallel, and one write clobbers the other. The fix requires both design \(idempotency, atomic operations\) and documentation \(explicit concurrency warnings in tool descriptions\). Server-side locking is the last line of defense when the model ignores documentation—which it will, because the model does not reason about concurrency the way a programmer does.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T11:20:07.828251+00:00— report_created — created