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

Function toolAddInterlinkedContext

src/tools/memory-tools.ts:110–132  ·  view source on GitHub ↗
(options: AddInterlinkedContextOptions)

Source from the content-addressed store, hash-verified

108}
109
110export 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
134export async function toolRetrieveWithTraversal(options: RetrieveWithTraversalOptions): Promise<string> {
135 const results = await retrieveWithTraversal(options.rootDir, options.startNodeId, options.maxDepth, options.edgeFilter);

Callers 2

index.tsFile · 0.85

Calls 2

addInterlinkedContextFunction · 0.85
getGraphStatsFunction · 0.85

Tested by

no test coverage detected