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

Function toolCreateRelation

src/tools/memory-tools.ts:71–82  ·  view source on GitHub ↗
(options: CreateRelationOptions)

Source from the content-addressed store, hash-verified

69}
70
71export 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
84export async function toolSearchMemoryGraph(options: SearchMemoryGraphOptions): Promise<string> {
85 const result = await searchGraph(options.rootDir, options.query, options.maxDepth, options.topK, options.edgeFilter);

Callers 2

index.tsFile · 0.85

Calls 2

createRelationFunction · 0.85
getGraphStatsFunction · 0.85

Tested by

no test coverage detected