(options: SearchMemoryGraphOptions)
| 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); |
| 86 | if (result.direct.length === 0) return `No memory nodes found for: "${options.query}"\nGraph has ${result.totalNodes} nodes, ${result.totalEdges} edges.`; |
| 87 | |
| 88 | const sections: string[] = [`Memory Graph Search: "${options.query}"`, `Graph: ${result.totalNodes} nodes, ${result.totalEdges} edges\n`]; |
| 89 | |
| 90 | sections.push("Direct Matches:"); |
| 91 | for (const hit of result.direct) sections.push(formatTraversalResult(hit)); |
| 92 | |
| 93 | if (result.neighbors.length > 0) { |
| 94 | sections.push("\nLinked Neighbors:"); |
| 95 | for (const neighbor of result.neighbors) sections.push(formatTraversalResult(neighbor)); |
| 96 | } |
| 97 | |
| 98 | return sections.join("\n"); |
| 99 | } |
| 100 | |
| 101 | export async function toolPruneStaleLinks(options: PruneStaleLinksOptions): Promise<string> { |
| 102 | const result = await pruneStaleLinks(options.rootDir, options.threshold); |
no test coverage detected