delete_relations
Remove specific connections between entities in the knowledge graph to maintain accurate relationship data and eliminate outdated or incorrect associations.
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:656-664 (handler)The main handler function in KnowledgeGraphManager that deletes the specified relations from the graph by filtering them out and saving 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:1042-1060 (schema)The input schema defining the expected parameters for the delete_relations tool: an array of relations with from, to, and relationType.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:1039-1061 (registration)Registration of the delete_relations tool in the list of tools returned by ListToolsRequestSchema.{ 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:1235-1237 (registration)The switch case in CallToolRequestSchema handler that routes calls to delete_relations to the KnowledgeGraphManager method.case "delete_relations": await knowledgeGraphManager.deleteRelations(args.relations as Relation[]); return { content: [{ type: "text", text: "Relations deleted successfully" }] };