MCPcopy Index your code
hub / github.com/TanStack/ai / parseSse

Function parseSse

testing/e2e/tests/mcp-managed.spec.ts:31–45  ·  view source on GitHub ↗
(body: string)

Source from the content-addressed store, hash-verified

29}
30
31function parseSse(body: string): Array<StreamEvent> {
32 const events: Array<StreamEvent> = []
33 for (const line of body.split('\n')) {
34 const trimmed = line.trim()
35 if (!trimmed.startsWith('data:')) continue
36 const json = trimmed.slice('data:'.length).trim()
37 if (!json) continue
38 try {
39 events.push(JSON.parse(json) as StreamEvent)
40 } catch {
41 // Ignore non-JSON keepalive lines.
42 }
43 }
44 return events
45}
46
47test.describe('mcp-managed — chat({ mcp }) discovery + lifecycle', () => {
48 test('chat({ mcp }) discovers get_guitar_price and the result reaches the transcript', async ({

Callers 1

Calls 2

parseMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected