delete_entities
Remove entities and their related connections from the Knowledge Graph Memory Server. Input entity names to delete unwanted data and maintain accurate, organized graph structures.
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
- src/memory/index.ts:142-147 (handler)Core implementation in KnowledgeGraphManager that loads the graph, filters out the specified entities and any 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); }
- src/memory/index.ts:318-337 (registration)Registers the 'delete_entities' MCP tool, including its schema and thin wrapper handler that delegates to KnowledgeGraphManager.deleteEntities.server.registerTool( "delete_entities", { title: "Delete Entities", description: "Delete multiple entities and their associated relations from the knowledge graph", inputSchema: { entityNames: z.array(z.string()).describe("An array of entity names to delete") }, outputSchema: { success: z.boolean(), message: z.string() } }, async ({ entityNames }) => { await knowledgeGraphManager.deleteEntities(entityNames); return { content: [{ type: "text" as const, text: "Entities deleted successfully" }], structuredContent: { success: true, message: "Entities deleted successfully" } }; }
- src/memory/index.ts:320-329 (schema)Zod-based input/output schema for the delete_entities tool: input is array of entity names, output is success boolean and message.{ title: "Delete Entities", description: "Delete multiple entities and their associated relations from the knowledge graph", inputSchema: { entityNames: z.array(z.string()).describe("An array of entity names to delete") }, outputSchema: { success: z.boolean(), message: z.string() }