delete_entities
Remove specified entities and their associated observations or relations by names using the delete entity tool.
Instructions
Delete entities (and cascaded observations/relations) by their names.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| entityNames | Yes | Names of entities to delete. |
Implementation Reference
- src/server.js:112-123 (registration)Registration of the MCP 'delete_entities' tool, including Zod input schema (entityNames: string[]) and thin handler that delegates to KnowledgeGraphManager.deleteEntities(entityNames).// Tool: delete_entities this.tool( 'delete_entities', 'Delete entities (and cascaded observations/relations) by their names.', { entityNames: z.array(z.string()).describe('Names of entities to delete.') }, async ({ entityNames }) => { await this.#knowledgeGraphManager.deleteEntities(entityNames); return { content: [{ type: 'text', text: 'Entities deleted' }] }; } );
- src/server.js:117-117 (schema)Zod schema definition for the tool input parameter 'entityNames'.entityNames: z.array(z.string()).describe('Names of entities to delete.')
- KnowledgeGraphManager.deleteEntities method, which delegates the deletion to the underlying database repository.async deleteEntities(names) { await this.#repository.deleteEntities(names); }
- src/sqlite/graph-repo.js:142-149 (helper)SQLite-specific implementation of deleteEntities: executes DELETE FROM entities WHERE name IN (...) which cascades to observations and relations.async deleteEntities(names) { if (!names.length) { return; } const placeholders = names.map(() => '?').join(','); await this.db.run(`DELETE FROM entities WHERE name IN (${placeholders})`, names); }
- src/postgres/graph-repo.js:239-250 (helper)PostgreSQL-specific implementation of deleteEntities: executes DELETE FROM entities WHERE name = ANY($1), assuming cascade deletes.async deleteEntities(names) { if (!names.length) { return; } await this.#query( `DELETE FROM entities WHERE name = ANY ($1)`, [ names ] ); }