MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / initializeSession

Function initializeSession

e2e/selfhost/toolkits-mcp.test.ts:28–51  ·  view source on GitHub ↗
(url: string, bearer: string)

Source from the content-addressed store, hash-verified

26`;
27
28const 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
53const callToolsListWithSession = async (
54 url: string,

Callers 1

Calls 2

getMethod · 0.65
fetchFunction · 0.50

Tested by

no test coverage detected