(url: string, bearer: string)
| 26 | `; |
| 27 | |
| 28 | const initializeSession = async (url: string, bearer: string): Promise<string> => { |
| 29 | const response = await fetch(url, { |
| 30 | method: "POST", |
| 31 | headers: { |
| 32 | authorization: `Bearer ${bearer}`, |
| 33 | "content-type": "application/json", |
| 34 | accept: "application/json, text/event-stream", |
| 35 | }, |
| 36 | body: JSON.stringify({ |
| 37 | jsonrpc: "2.0", |
| 38 | id: 1, |
| 39 | method: "initialize", |
| 40 | params: { |
| 41 | protocolVersion: "2025-03-26", |
| 42 | capabilities: {}, |
| 43 | clientInfo: { name: "toolkit-e2e", version: "1" }, |
| 44 | }, |
| 45 | }), |
| 46 | }); |
| 47 | expect(response.status, "toolkit initialize succeeds").toBe(200); |
| 48 | const sessionId = response.headers.get("mcp-session-id"); |
| 49 | expect(sessionId, "initialize returns a session id").toEqual(expect.any(String)); |
| 50 | return sessionId!; |
| 51 | }; |
| 52 | |
| 53 | const callToolsListWithSession = async ( |
| 54 | url: string, |
no test coverage detected