The Reachy Mini conversation app opens a new MCP connection for every tool call
Kind: idiosyncrasy · Status: current · Last verified: 2026-11-26 · Clients: reachy-mini-conversation-app · Revisions: 2025-11-25, 2026-07-28
At 622a3a67, RemoteMcpToolClient._connected_client builds a new httpx2.AsyncClient, a new streamable_http_client and a new mcp.Client each time it is entered, and closes all three on exit. list_tool_specs and call_tool each enter it once. Client is built from the transport alone, so mode is the SDK default auto.
What a server sees for one model tool call
This order is read from the code and mcp 2.2.0. No probe run has captured it.
server/discoverat2026-07-28. A server that answers with a modern version gets the rest of the exchange in the per-request_metaenvelope. Any other answer leads toinitializeoffering2025-11-25, thennotifications/initialized.tools/call.tools/list, one page with no cursor, when the result is not an error.ClientSession.call_toolvalidatesstructuredContentagainst the tool'soutputSchemaand lists tools first when the session has no cached schema. A per-call session never has one. A tool that is not on the first page is logged and left unvalidated.- A DELETE when the transport closes, if a handshake-era server issued a session id.
streamable_http_clientdefaults toterminate_on_close=True.
What follows from it
- On a
2026-07-28connection the SDK mirrors arguments annotated withx-mcp-headerintoMcp-Param-*request headers only for tools listed earlier on the same session.tools/callis the first request after discover, so those headers are never sent. - No session is open between calls and
Clientgets nomessage_handler, sonotifications/tools/list_changedhas nothing to arrive on. The model's tool list comes frominstalled_tool_spaces.json, written when a person installs or refreshes a Space. RemoteMcpTool.__call__sends the call again after 0.25 s when it raisesMcpToolInvocationError.call_toolwraps every exception that is not a timeout in that class, including the SDK'sRuntimeErrorforstructuredContentthat failsoutputSchema. The server has run the tool by then, so a non-idempotent tool runs twice before the model sees the error. Timeouts are not retried.- The SDK's response cache is on by default, and it lives inside each
Client, so nothing is reused from one call to the next.
crewAI's native route has the same shape on mcp 1.30.0 ([[crewai-opens-a-new-mcp-session-for-every-tool-call]]). This client adds the discover probe in front of each call because it runs on the 2.x SDK in auto mode.
Sources
- src/reachy_mini_conversation_app/mcp_client.py, RemoteMcpToolClient and _connected_client, commit
622a3a67,src/reachy_mini_conversation_app/mcp_client.py:292-381, 2026-11-26 - src/reachy_mini_conversation_app/tools/core_tools.py, RemoteMcpTool.call retry, commit
622a3a67,src/reachy_mini_conversation_app/tools/core_tools.py:96,125-140, 2026-11-26 - mcp 2.2.0, mcp/client/_probe.py, negotiate_auto,
mcp/client/_probe.py:52-113, 2026-11-26 - mcp 2.2.0, mcp/client/session.py, call_tool, validate_tool_result and _absorb_tool_listing,
mcp/client/session.py:1065-1131,1291-1309, 2026-11-26 - mcp 2.2.0, mcp/client/streamable_http.py, terminate_on_close,
mcp/client/streamable_http.py:681-686,755, 2026-11-26