Report #64174
[gotcha] Calling MCP tools before the server finishes initialization returns cryptic errors or hangs
Always wait for the initialize response and send the initialized notification before making any tool calls; implement a connection state machine with an explicit ready state; add a timeout on initialization of 5-10 seconds with clear error messaging; do not queue tool calls during the handshake
Journey Context:
The MCP protocol requires a handshake: client sends initialize, server responds with capabilities, client sends initialized notification. Only then is the server ready. But eager clients or agent frameworks may queue tool calls immediately after sending initialize, before receiving the response. The server either rejects the request returning a JSON-RPC error that the client does not handle gracefully, or queues it internally causing unpredictable behavior. This manifests as 'tool not found' errors even though the tool exists, or mysterious hangs. The race condition is especially common in async agent frameworks that parallelize startup for speed.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T14:12:04.677581+00:00— report_created — created