pub fn write_method_not_found_pre_init(
id: &Value,
method: &str,
protocol: &SharedProtocol,
)Expand description
GH #1454: a well-formed JSON-RPC request with an unrecognized method
reached the pre-init handshake loop. rmcp’s ClientRequest union has a
CustomRequest catch-all, so the message deserialized fine — the #1434
handler in try_parse_with_compatibility (deser-failure path) never
fired — and the pre-init loop rejected it with
ServerInitializeError::ExpectedInitializeRequest. Modern clients (MCP
Go SDK >= 1.7, e.g. Antigravity) probe with server/discover first and
fall back to the legacy initialize handshake ONLY after a spec-compliant
-32601. Reply with the same framing the client established, and keep the
process alive so the fallback initialize lands on this connection.
The message mirrors the legacy-handshake-only contract so dual-era clients can detect the server class and proceed.