delete_entities
Remove specified entities and their relations from the MCP Memory Server’s knowledge graph to maintain accurate and up-to-date data for large language models.
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
- src/index.ts:104-109 (handler)The core implementation of delete_entities in KnowledgeGraphManager class. Deletes specified entities and all relations connected to them from the persistent knowledge 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/index.ts:278-288 (schema)Input schema definition for the delete_entities tool, specifying an array of entity names.inputSchema: { type: "object", properties: { entityNames: { type: "array", items: { type: "string" }, description: "An array of entity names to delete" }, }, required: ["entityNames"], },
- src/index.ts:275-289 (registration)Tool registration in the listTools response, including 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"], }, },
- src/index.ts:390-392 (registration)Dispatch handler in the CallToolRequestSchema switch statement that invokes the deleteEntities method.case "delete_entities": await knowledgeGraphManager.deleteEntities(args.entityNames as string[]); return { content: [{ type: "text", text: "Entities deleted successfully" }] };