MCPcopy Create free account
hub / github.com/serverless/examples / main

Function main

aws-bedrock-agentcore/javascript/mcp-server/test-invoke.js:116–148  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

114}
115
116async function main() {
117 console.log('MCP Server Test Suite')
118 console.log(`Runtime ARN: ${RUNTIME_ARN}`)
119 console.log(`Region: ${REGION}`)
120 console.log('='.repeat(50) + '\n')
121
122 // Step 1: Initialize
123 await testInitialize()
124
125 // Step 2: Send initialized notification
126 const notifPayload = { jsonrpc: '2.0', method: 'notifications/initialized' }
127 const notifCommand = new InvokeAgentRuntimeCommand({
128 agentRuntimeArn: RUNTIME_ARN,
129 qualifier: 'DEFAULT',
130 runtimeSessionId: sessionId,
131 payload: Buffer.from(JSON.stringify(notifPayload)),
132 contentType: 'application/json',
133 accept: 'application/json, text/event-stream',
134 })
135 await client.send(notifCommand)
136
137 // Step 3: List tools
138 await testListTools()
139
140 // Step 4: Call each tool
141 await testCallTool('add', { a: 5, b: 3 }, 10)
142 await testCallTool('multiply', { a: 7, b: 6 }, 11)
143 await testCallTool('get_current_time', { timezone: 'UTC' }, 12)
144 await testCallTool('get_current_time', { timezone: 'America/New_York' }, 13)
145
146 console.log('='.repeat(50))
147 console.log('All tests completed!')
148}
149
150main().catch((err) => {
151 console.error('Test failed:', err)

Callers 1

test-invoke.jsFile · 0.70

Calls 4

testInitializeFunction · 0.85
testListToolsFunction · 0.85
testCallToolFunction · 0.85
sendMethod · 0.45

Tested by

no test coverage detected