MCPcopy Index your code
hub / github.com/forloopcodes/contextplus / toolSearchMemoryGraph

Function toolSearchMemoryGraph

src/tools/memory-tools.ts:84–99  ·  view source on GitHub ↗
(options: SearchMemoryGraphOptions)

Source from the content-addressed store, hash-verified

82}
83
84export 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
101export async function toolPruneStaleLinks(options: PruneStaleLinksOptions): Promise<string> {
102 const result = await pruneStaleLinks(options.rootDir, options.threshold);

Callers 2

index.tsFile · 0.85

Calls 2

searchGraphFunction · 0.85
formatTraversalResultFunction · 0.85

Tested by

no test coverage detected