https://retellai.com/?utm_source=discord&utm_medium=seo logo
MCP Server tool calls not stable
# ❓・bug-report
r
I have connected my server and tools but the AI agent isn't consistently being able to send and receive data. In the same call, it was able to retrieve the data once, and then asking again it produced this error: tool_call_id: bec3c9b26484dd74 "Error POSTing to endpoint (HTTP 400): {\"jsonrpc\":\"2.0\",\"error\":{\"code\":-32000,\"message\":\"Bad Request: Server not initialized\"},\"id\":null}" Screenshots show the transcript, successful pull, and subsequent errors. Please let me know what's going on with the MCPs as I need to know if I have to change my architecture as my business can't have inconsistencies like this for our clients. Thanks https://cdn.discordapp.com/attachments/1409520321450479656/1409520322956496946/Retell_Support_1.png?ex=68adad98&is=68ac5c18&hm=cf3ea6d5a79f702b8ed9c45fa164b9bc3f3081b0a869f103c40d5fbc7068ef21& https://cdn.discordapp.com/attachments/1409520321450479656/1409520324139024414/Retell_SUpport_2_.png?ex=68adad98&is=68ac5c18&hm=24f9ad3cb0c4baa424291fef630b1cb907d0c5152360a77fee95cf8e68a78908& https://cdn.discordapp.com/attachments/1409520321450479656/1409520324797534358/Retell_SUpport_3.png?ex=68adad99&is=68ac5c19&hm=5420b7a4e8257f1512353582880caf69a163232635cf68d30fddc5ae24262014& https://cdn.discordapp.com/attachments/1409520321450479656/1409520325682794608/Retell_Support_4.png?ex=68adad99&is=68ac5c19&hm=220f3be0c710d494e69f422234539584476b257886f008d4fda588f73714d564&
s
The error isn’t random — it happens because the MCP server loses its session. The first call worked since the server was initialized, but later calls failed with “Server not initialized”. That means either: The client didn’t resend the MCP session ID header, or The server restarted/transport dropped and the client didn’t re-run the initialize → initialized handshake. To fix: Make sure your client always carries the mcp-session-id header (CORS/proxies can strip it). If the server restarts or a 400 error happens, redo the handshake before retrying the tool call. For stability, prefer a persistent transport (stdio/WebSocket) or keep your HTTP server process warm.
r
how do I do this in retell? Isn't retell the client? Make sure your client always carries the mcp-session-id header (CORS/proxies can strip it).
"Thank you for the technical details regarding MCP session management. Your diagnosis appears to be correct. I have confirmed that the first tool call in a live conversation succeeds, but all subsequent tool calls within the same conversation fail with the 400 Bad Request: Server not initialized error. This proves that the initial handshake is working, but my Retell agent is failing to persist and resend the mcp-session-id header on subsequent requests, causing the session to be lost. As the management of this header is a client-side responsibility, this appears to be a bug in the Retell agent's implementation of the MCP protocol. Can you please escalate this to your engineering team to investigate why the agent is dropping the mcp-session-id header after the first successful tool call? This is a critical, blocking issue for our project. Here is the Call ID of a session that demonstrates this exact failure pattern: call_baed9bbd9d5b81bac16ad5b5c3d."
@shehroze_retell Just making sure you saw this.
s
Thanks for confirming the behavior with the call ID. I’ve escalated this to our engineering team as a potential bug in the MCP client implementation. In the meantime, if you hit the Server not initialized error, the only workaround is to force a re-handshake (initialize → initialized) before retrying the tool call. I’ll update you as soon as I hear back from engineering on a permanent fix.
r
thanks so much. Just so I know, how would I force a re-handshake ? I ended up having to clone the agent and create all new custom fuctions.
s
you’d need to hook into the error handler, and when you see that error, restart the MCP session (essentially resetting the Retell→MCP connection so that initialize is sent again).
s
can you please share your org id
r
Iwasn't able to find an Org ID, but I found this: Workspace ID org_tbYW3cSbrfaXHQgB
I basically had to reconfigure my whole agent to use custom functions, but I would really like to upgrade into MCP full-time. Please let me know if this issue can be solved or at least will be put into your pipeline to fix. thanks
please tag me in your replies so I get an email notif. Thanks.
@shahretell Any updates?
s
@realee_23147 Your issue has been forwarded to the team. I will tag you as soon as there is an update.
r
Okay, thanks
s
can you please providing some call ids as an example?
r
@shahretell - please tag me in your replies so i get an email notif. call_baed9bbd9d5b81bac16ad5b5c3d call_7ee5b8e2a32ad60dc02da6445b3 call_d6ea01de193e333913f5534eebf - this is one where it worked once and then not again in the same call. Thanks
s
okay
r
👍
@shahretell any update?
@shahretell any update?
@Colin - Integrations @ Retell AI @Omar Ashraf | Community Lead Can you guys look into this? It's been over a month.
???