delete_entities
Remove specific entities and their associated relationships from the Knowledge Graph Memory Server to maintain accurate and up-to-date data storage.
Instructions
Delete multiple entities and their associated relations from the knowledge graph
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| entityNames | Yes | An array of entity names to delete |
Implementation Reference
- index.ts:124-129 (handler)The core handler function in KnowledgeGraphManager that loads the graph, filters out the specified entities and all relations connected to them, then saves the updated graph.async deleteEntities(entityNames: string[]): Promise<void> { const graph = await this.loadGraph(); graph.entities = graph.entities.filter(e => !entityNames.includes(e.name)); graph.relations = graph.relations.filter(r => !entityNames.includes(r.from) && !entityNames.includes(r.to)); await this.saveGraph(graph); }
- index.ts:360-370 (schema)Input schema defining the expected structure for the tool arguments: an object with a required 'entityNames' array of strings.inputSchema: { type: "object", properties: { entityNames: { type: "array", items: { type: "string" }, description: "An array of entity names to delete" }, }, required: ["entityNames"], },
- index.ts:357-371 (registration)Registration of the 'delete_entities' tool in the ListTools response, providing name, description, and input schema.{ name: "delete_entities", description: "Delete multiple entities and their associated relations from the knowledge graph", inputSchema: { type: "object", properties: { entityNames: { type: "array", items: { type: "string" }, description: "An array of entity names to delete" }, }, required: ["entityNames"], }, },
- index.ts:520-522 (handler)Tool dispatcher in the CallToolRequestHandler switch statement that calls the deleteEntities method with parsed arguments and returns a success response.case "delete_entities": await knowledgeGraphManager.deleteEntities(args.entityNames as string[]); return { content: [{ type: "text", text: "Entities deleted successfully" }] };