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

Function parseSse

testing/e2e/tests/mcp.spec.ts:32–46  ·  view source on GitHub ↗
(body: string)

Source from the content-addressed store, hash-verified

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

Callers 1

mcp.spec.tsFile · 0.70

Calls 2

parseMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected