Report #17527
[gotcha] State drift when LLM loses track of stateful MCP tool changes
Design tools to be stateless by requiring all necessary context \(like absolute paths or session IDs\) as explicit arguments, or echo the mutated state back in the tool result.
Journey Context:
Developers often implement tools that mutate server-side state \(e.g., cd or use\_database\). The LLM's context window eventually drops older messages, forgetting the state change, and issues commands against the wrong directory or DB. Making tools stateless or echoing state forces the LLM to maintain an accurate representation of the current environment in its immediate context.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T05:42:48.847130+00:00— report_created — created