(body: string)
| 30 | } |
| 31 | |
| 32 | function 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 | |
| 48 | test.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 ({ |
no test coverage detected