Summary
In src/handlers.ts (around line 413–421), when the connection bootstrap fails (initialize, getClient, or ensureIntrospected throw), the error is currently wrapped and thrown as "Bad Request: Server not initialized". This means toStructuredError() cannot extract the underlying cause and return a structured CONNECTION_FAILED payload to MCP clients.
Desired behaviour
The bootstrap catch (initError) block should call createConnectionFailedError(...) and return its result directly (as a structured tool error response), instead of re-throwing wrapped in a "Bad Request" error. This allows clients to receive the full ConnectionFailedError payload — including instance_url, reconnecting, and suggested_fix — without needing to parse a generic error string.
Why it was deferred
The change alters the public error contract for the bootstrap failure path and was therefore considered out of scope for PR #369 (connection resilience).
References
Summary
In
src/handlers.ts(around line 413–421), when the connection bootstrap fails (initialize,getClient, orensureIntrospectedthrow), the error is currently wrapped and thrown as"Bad Request: Server not initialized". This meanstoStructuredError()cannot extract the underlying cause and return a structuredCONNECTION_FAILEDpayload to MCP clients.Desired behaviour
The bootstrap
catch (initError)block should callcreateConnectionFailedError(...)and return its result directly (as a structured tool error response), instead of re-throwing wrapped in a"Bad Request"error. This allows clients to receive the fullConnectionFailedErrorpayload — includinginstance_url,reconnecting, andsuggested_fix— without needing to parse a generic error string.Why it was deferred
The change alters the public error contract for the bootstrap failure path and was therefore considered out of scope for PR #369 (connection resilience).
References