(options: CreateRelationOptions)
| 69 | } |
| 70 | |
| 71 | export async function toolCreateRelation(options: CreateRelationOptions): Promise<string> { |
| 72 | const edge = await createRelation(options.rootDir, options.sourceId, options.targetId, options.relation, options.weight, options.metadata); |
| 73 | if (!edge) return `❌ Failed: one or both node IDs not found (source: ${options.sourceId}, target: ${options.targetId})`; |
| 74 | |
| 75 | const stats = await getGraphStats(options.rootDir); |
| 76 | return [ |
| 77 | `✅ Relation created: ${options.sourceId} --[${edge.relation}]--> ${options.targetId}`, |
| 78 | ` Edge ID: ${edge.id}`, |
| 79 | ` Weight: ${edge.weight}`, |
| 80 | `\nGraph: ${stats.nodes} nodes, ${stats.edges} edges`, |
| 81 | ].join("\n"); |
| 82 | } |
| 83 | |
| 84 | export async function toolSearchMemoryGraph(options: SearchMemoryGraphOptions): Promise<string> { |
| 85 | const result = await searchGraph(options.rootDir, options.query, options.maxDepth, options.topK, options.edgeFilter); |
no test coverage detected