delete_relations
Remove specific relations from the Knowledge Graph Memory Server by specifying 'from', 'to', and 'relationType' for efficient data management.
Instructions
Delete multiple relations from the knowledge graph
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| relations | Yes | An array of relations to delete |
Implementation Reference
- index.ts:142-150 (handler)The deleteRelations method in KnowledgeGraphManager class that loads the graph, filters out the specified relations, and saves the updated graph.async deleteRelations(relations: Relation[]): Promise<void> { const graph = await this.loadGraph(); graph.relations = graph.relations.filter(r => !relations.some(delRelation => r.from === delRelation.from && r.to === delRelation.to && r.relationType === delRelation.relationType )); await this.saveGraph(graph); }
- index.ts:397-419 (schema)Tool schema definition including name, description, and input schema for validating delete_relations tool calls.{ name: "delete_relations", description: "Delete multiple relations from the knowledge graph", inputSchema: { type: "object", properties: { relations: { type: "array", items: { type: "object", properties: { from: { type: "string", description: "The name of the entity where the relation starts" }, to: { type: "string", description: "The name of the entity where the relation ends" }, relationType: { type: "string", description: "The type of the relation" }, }, required: ["from", "to", "relationType"], }, description: "An array of relations to delete" }, }, required: ["relations"], }, },
- index.ts:526-528 (registration)Switch case in CallToolRequestSchema handler that registers and invokes the delete_relations tool by calling the manager method.case "delete_relations": await knowledgeGraphManager.deleteRelations(args.relations as Relation[]); return { content: [{ type: "text", text: "Relations deleted successfully" }] };
- index.ts:39-45 (schema)TypeScript interface defining the structure of a Relation object used in the delete_relations tool input.interface Relation { from: string; to: string; relationType: string; createdAt: string; version: number; }