delete_entities
Remove specific entities and their related connections from the Knowledge Graph Memory Server to maintain accurate and updated data in the memory system.
Instructions
Delete multiple entities and their associated relations from the knowledge graph
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| entityNames | Yes | An array of entity names to delete |
Input Schema (JSON Schema)
{
"properties": {
"entityNames": {
"description": "An array of entity names to delete",
"items": {
"type": "string"
},
"type": "array"
}
},
"required": [
"entityNames"
],
"type": "object"
}
Implementation Reference
- index.ts:638-642 (handler)The handler function in KnowledgeGraphManager class that loads the graph, filters out the specified entities and their related 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)JSON schema defining the input for the delete_entities tool: an object with required array of entity names.inputSchema: { type: "object", properties: { entityNames: { type: "array", items: { type: "string" }, description: "An array of entity names to delete" }, }, required: ["entityNames"], },
- index.ts:999-1013 (registration)Registration of the delete_entities tool in the list of tools returned by ListToolsRequestHandler.{ 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)Dispatch case in CallToolRequestHandler switch that invokes the deleteEntities handler.case "delete_entities": await knowledgeGraphManager.deleteEntities(args.entityNames as string[]); return { content: [{ type: "text", text: "Entities deleted successfully" }] };