EU Parliament Monitor - API Documentation - v0.7.0
    Preparing search index...

    Function parseSSEResponse

    • Parse an SSE (Server-Sent Events) response body to extract the first valid JSON-RPC message.

      The MCP Streamable HTTP protocol sends JSON-RPC responses as SSE data: lines. This function returns the first successfully parsed JSON-RPC message; any subsequent data: lines are ignored. This matches the MCP protocol expectation of one JSON-RPC response per HTTP request/response cycle.

      Parameters

      • body: string

        Raw SSE response text (may contain multiple lines including event: and data:)

      Returns JSONRPCResponse | null

      The first valid JSON-RPC response found, or null if no valid message exists