MCPcopy Index your code
hub / github.com/simstudioai/sim / callInitialize

Function callInitialize

apps/sim/app/api/mcp/serve/[serverId]/route.test.ts:909–930  ·  view source on GitHub ↗
(protocolVersion?: string)

Source from the content-addressed store, hash-verified

907
908 describe('initialize protocol version negotiation', () => {
909 async function callInitialize(protocolVersion?: string) {
910 dbChainMockFns.limit.mockResolvedValueOnce([
911 {
912 id: 'server-1',
913 name: 'Public Server',
914 workspaceId: 'ws-1',
915 isPublic: true,
916 createdBy: 'owner-1',
917 },
918 ])
919 const params: Record<string, unknown> = {
920 capabilities: {},
921 clientInfo: { name: 'test', version: '1.0.0' },
922 }
923 if (protocolVersion !== undefined) params.protocolVersion = protocolVersion
924 const req = new NextRequest('http://localhost:3000/api/mcp/serve/server-1', {
925 method: 'POST',
926 body: JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'initialize', params }),
927 })
928 const res = await POST(req, { params: Promise.resolve({ serverId: 'server-1' }) })
929 return res.json() as Promise<{ result: { protocolVersion: string } }>
930 }
931
932 it('echoes a supported client protocolVersion (2025-06-18)', async () => {
933 const body = await callInitialize('2025-06-18')

Callers 1

route.test.tsFile · 0.85

Calls 2

POSTFunction · 0.90
resolveMethod · 0.65

Tested by

no test coverage detected