(name, args)
| 58 | |
| 59 | let rpcId = 1; |
| 60 | async function tool(name, args) { |
| 61 | const res = await fetch(`${ORIGIN}/rpc`, { |
| 62 | method: 'POST', headers: { 'Content-Type': 'application/json' }, |
| 63 | body: JSON.stringify({ jsonrpc: '2.0', id: rpcId++, method: 'tools/call', params: { name, arguments: args } }), |
| 64 | }); |
| 65 | const body = await res.json(); |
| 66 | const text = body?.result?.content?.[0]?.text ?? ''; |
| 67 | try { return JSON.parse(text); } catch { return { raw: text }; } |
| 68 | } |
| 69 | |
| 70 | /** Die eingehenden Kanten eines Namens, so wie der Index sie kennt. */ |
| 71 | async function incoming(name) { |
no test coverage detected