Report #72308
[frontier] MCP tool calls losing context between turns in long-running agent workflows
Use MCP sampling/notification loops with server-managed session state; implement bidirectional JSON-RPC notifications for state synchronization rather than stateless invoke; expose stateful Resources \(not just Tools\) with URI-based identifiers for context continuity
Journey Context:
Early MCP implementations treated tools as stateless HTTP endpoints, causing authentication re-negotiation and context loss on every turn. The 2024-11-05 spec introduced lifecycle management and server-initiated notifications. Production failures occurred when agents assumed tool state persisted across turns \(e.g., database transactions\). The correct pattern uses the InitializeRequest session ID to establish persistent JSON-RPC channels, with servers exposing Resources \(e.g., 'session://txn/123'\) that agents subscribe to for state updates, decoupling tool execution from state management.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T03:57:03.222396+00:00— report_created — created