MCPcopy
hub / github.com/xpf0000/FlyEnv / call

Function call

tmp/mcp-quick-test.ts:13–25  ·  view source on GitHub ↗
(name: string, args: any)

Source from the content-addressed store, hash-verified

11}
12
13async function call(name: string, args: any) {
14 const client = new Client({ name: 'quick-test', version: '1.0.0' })
15 const transport = new StreamableHTTPClientTransport(new URL(url), { fetch: fetchWithAuth })
16 await client.connect(transport)
17 try {
18 const result = await client.callTool({ name, arguments: args })
19 console.log(`\n=== ${name} ===`)
20 console.log(JSON.stringify(result, null, 2))
21 } finally {
22 await client.close().catch(() => {})
23 await transport.close().catch(() => {})
24 }
25}
26
27async function main() {
28 await call('list_sites', {})

Callers 1

mainFunction · 0.70

Calls 3

catchMethod · 0.80
logMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected