MCPcopy
hub / github.com/modelcontextprotocol/servers / saveGraph

Method saveGraph

src/memory/index.ts:101–117  ·  view source on GitHub ↗
(graph: KnowledgeGraph)

Source from the content-addressed store, hash-verified

99 }
100
101 private async saveGraph(graph: KnowledgeGraph): Promise<void> {
102 const lines = [
103 ...graph.entities.map(e => JSON.stringify({
104 type: "entity",
105 name: e.name,
106 entityType: e.entityType,
107 observations: e.observations
108 })),
109 ...graph.relations.map(r => JSON.stringify({
110 type: "relation",
111 from: r.from,
112 to: r.to,
113 relationType: r.relationType
114 })),
115 ];
116 await fs.writeFile(this.memoryFilePath, lines.join("\n"));
117 }
118
119 async createEntities(entities: Entity[]): Promise<Entity[]> {
120 const graph = await this.loadGraph();

Callers 6

createEntitiesMethod · 0.95
createRelationsMethod · 0.95
addObservationsMethod · 0.95
deleteEntitiesMethod · 0.95
deleteObservationsMethod · 0.95
deleteRelationsMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected