delete_entities
Remove specified entities and their relationships from the knowledge graph to maintain accurate and relevant data.
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:638-643 (handler)The core handler function in KnowledgeGraphManager that executes the delete_entities tool logic: loads the graph, removes specified entities and their connected relations, 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:1002-1012 (schema)Input schema definition for the delete_entities tool, specifying 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:1000-1013 (registration)Tool registration in the ListTools response, defining name, description, and input schema for delete_entities.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:1229-1231 (registration)Dispatcher case in CallToolRequest handler that invokes the deleteEntities method and returns success response.case "delete_entities": await knowledgeGraphManager.deleteEntities(args.entityNames as string[]); return { content: [{ type: "text", text: "Entities deleted successfully" }] };