delete_relations
Remove specified connections between entities in the knowledge graph to maintain accurate relationship data.
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 core handler function in KnowledgeGraphManager that deletes the specified relations by filtering them out from the loaded graph and saving the changes to the memory file.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:400-418 (schema)JSON Schema defining the input structure for the delete_relations tool, specifying an array of relations with from, to, and relationType fields.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)Registers the handler for the delete_relations tool in the CallToolRequestHandler switch statement, dispatching calls to KnowledgeGraphManager.deleteRelations.case "delete_relations": await knowledgeGraphManager.deleteRelations(args.relations as Relation[]); return { content: [{ type: "text", text: "Relations deleted successfully" }] };
- index.ts:397-419 (registration)Tool registration in the ListToolsRequestHandler, including name, description, and input schema.{ 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:39-45 (schema)TypeScript interface defining the structure of a Relation object used by the delete_relations tool.interface Relation { from: string; to: string; relationType: string; createdAt: string; version: number; }