MCPcopy Create free account
hub / github.com/modelcontextprotocol/typescript-sdk / readSSEEvent

Function readSSEEvent

test/server/streamableHttp.test.ts:90–94  ·  view source on GitHub ↗

* Helper to extract text from SSE response * Note: Can only be called once per response stream. For multiple reads, * get the reader manually and read multiple times.

(response: Response)

Source from the content-addressed store, hash-verified

88 * get the reader manually and read multiple times.
89 */
90async function readSSEEvent(response: Response): Promise<string> {
91 const reader = response.body?.getReader();
92 const { value } = await reader!.read();
93 return new TextDecoder().decode(value);
94}
95
96/**
97 * Helper to send JSON-RPC request

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…