Report #5322
[gotcha] MCP server state desync causing tools to act on wrong context
Make tools stateless, or explicitly pass state \(like \`cwd\` or \`session\_id\`\) as required parameters in every tool call. Do not rely on server-side state that the LLM cannot see.
Journey Context:
A server might track a \`current\_directory\` variable. The LLM calls \`list\_files\(\)\` and gets results for \`/\`. It then calls \`change\_directory\('src'\)\` and \`list\_files\(\)\`. But if the LLM retries or parallelizes calls, the state gets corrupted. Statelessness ensures every tool call is self-contained and deterministic, matching the LLM's stateless generation model.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T21:04:56.268823+00:00— report_created — created