()
| 35 | |
| 36 | // Helper to initialize MCP session |
| 37 | async function initSession () { |
| 38 | const initializeRequest = { |
| 39 | jsonrpc: '2.0', |
| 40 | id: 1, |
| 41 | method: 'initialize', |
| 42 | params: { |
| 43 | protocolVersion: '2024-11-05', |
| 44 | capabilities: {}, |
| 45 | clientInfo: { |
| 46 | name: 'electerm-test-client', |
| 47 | version: '1.0.0' |
| 48 | } |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | const response = await makeHttpRequest('post', serverUrl, initializeRequest, { |
| 53 | 'Content-Type': 'application/json', |
| 54 | Accept: 'application/json, text/event-stream' |
| 55 | }) |
| 56 | |
| 57 | const sid = response.headers['mcp-session-id'] |
| 58 | assert.ok(sid && sid !== 'null', `initSession: expected a real session ID but got: ${sid}`) |
| 59 | return sid |
| 60 | } |
| 61 | |
| 62 | // Helper to call a tool via MCP |
| 63 | async function callTool (sessionId, id, toolName, args) { |
no test coverage detected