(options: AddInterlinkedContextOptions)
| 108 | } |
| 109 | |
| 110 | export async function toolAddInterlinkedContext(options: AddInterlinkedContextOptions): Promise<string> { |
| 111 | const result = await addInterlinkedContext(options.rootDir, options.items, options.autoLink); |
| 112 | const sections = [ |
| 113 | `✅ Added ${result.nodes.length} interlinked nodes`, |
| 114 | result.edges.length > 0 ? ` Auto-linked: ${result.edges.length} similarity edges (threshold ≥ 0.72)` : " No auto-links above threshold", |
| 115 | "\nNodes:", |
| 116 | ]; |
| 117 | |
| 118 | for (const node of result.nodes) { |
| 119 | sections.push(` [${node.type}] ${node.label} → ${node.id}`); |
| 120 | } |
| 121 | |
| 122 | if (result.edges.length > 0) { |
| 123 | sections.push("\nEdges:"); |
| 124 | for (const edge of result.edges) { |
| 125 | sections.push(` ${edge.source} --[${edge.relation} w:${Math.round(edge.weight * 100) / 100}]--> ${edge.target}`); |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | const stats = await getGraphStats(options.rootDir); |
| 130 | sections.push(`\nGraph total: ${stats.nodes} nodes, ${stats.edges} edges`); |
| 131 | return sections.join("\n"); |
| 132 | } |
| 133 | |
| 134 | export async function toolRetrieveWithTraversal(options: RetrieveWithTraversalOptions): Promise<string> { |
| 135 | const results = await retrieveWithTraversal(options.rootDir, options.startNodeId, options.maxDepth, options.edgeFilter); |
no test coverage detected