(name, args)
| 48 | |
| 49 | let rpcId = 1; |
| 50 | async function tool(name, args) { |
| 51 | const res = await fetch(`${ORIGIN}/rpc`, { |
| 52 | method: 'POST', |
| 53 | headers: { 'Content-Type': 'application/json' }, |
| 54 | body: JSON.stringify({ jsonrpc: '2.0', id: rpcId++, method: 'tools/call', params: { name, arguments: args } }), |
| 55 | }); |
| 56 | const body = await res.json(); |
| 57 | const text = body?.result?.content?.[0]?.text ?? ''; |
| 58 | try { return JSON.parse(text); } catch { return { raw: text, error: body?.error }; } |
| 59 | } |
| 60 | |
| 61 | async function cypher(project, query) { |
| 62 | return tool('query_graph', { project, query }); |
no test coverage detected