modernErrorFromBody

Inspect a 400/404/405 response body for a recognized modern JSON-RPC error before deciding whether to fall back to legacy HTTP+SSE. Per draft basic/transports §Backward Compatibility: "If the body contains a recognized modern JSON-RPC error, the server speaks a modern version of MCP — retry ... rather than falling back. If the body is empty or is not a recognized modern JSON-RPC error, fall back to initialize." Returns true and sets err to a typed McpException only when the body parses as a JSON-RPC error response whose code passes isModernRpcErrorCode; otherwise returns false (legacy fallback) and leaves err null. Never throws — a malformed/empty body is a legacy signal, not an error.

@safe nothrow
bool
modernErrorFromBody
(
string body
,)