delete_relations
Remove specified relations from the knowledge graph by defining the originating entity, terminating entity, and relation type for each entry.
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 by loading the graph, filtering out matching relations, 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)Input schema definition for the delete_relations tool, specifying the structure of the relations array to delete.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)Tool registration in the ListTools handler, defining the delete_relations tool with its 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:1235-1237 (registration)Dispatch handler in the CallToolRequestSchema switch statement that calls the deleteRelations method and returns success response.case "delete_relations": await knowledgeGraphManager.deleteRelations(args.relations as Relation[]); return { content: [{ type: "text", text: "Relations deleted successfully" }] };
- index.ts:31-35 (schema)TypeScript interface defining the structure of a Relation object used by the delete_relations tool.interface Relation { from: string; to: string; relationType: string; }