delete_observations
Remove specific observations from entities by matching exact text entries on the Memento MCP server, enabling precise data cleanup and management.
Instructions
Remove specific observations from entities by matching text.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| deletions | Yes | List of {entityName, observations} deletion requests. |
Implementation Reference
- src/server.js:142-156 (registration)MCP Server tool registration for 'delete_observations', including Zod input schema validation and thin handler that delegates to KnowledgeGraphManager.deleteObservations// Tool: delete_observations this.tool( 'delete_observations', 'Remove specific observations from entities by matching text.', { deletions: z.array(z.object({ entityName: z.string().describe('Name of the entity.'), observations: z.array(z.string()).describe('Exact observation texts to delete.') })).describe('List of {entityName, observations} deletion requests.') }, async ({ deletions }) => { await this.#knowledgeGraphManager.deleteObservations(deletions); return { content: [{ type: 'text', text: 'Observations deleted' }] }; } );
- KnowledgeGraphManager.deleteObservations: resolves entity names to IDs and delegates deletions to the GraphRepositoryasync deleteObservations(list) { for (const { entityName, observations } of list) { const entityId = await this.#repository.getEntityId(entityName); if (!entityId) continue; await this.#repository.deleteObservations(entityId, observations); } }
- src/postgres/graph-repo.js:285-297 (helper)PostgresGraphRepository.deleteObservations: SQL DELETE query to remove matching observations by entity_id and content listasync deleteObservations(entityId, observations) { if (!observations.length) { return; } await this.#query( `DELETE FROM observations WHERE entity_id = $1 AND content = ANY ($2)`, [ entityId, observations ] ); }
- src/sqlite/graph-repo.js:177-187 (helper)SqliteGraphRepository.deleteObservations: SQL DELETE query to remove matching observations by entity_id and content listasync deleteObservations(entityId, observations) { if (!observations.length) { return; } const placeholders = observations.map(() => '?').join(','); await this.db.run( `DELETE FROM observations WHERE entity_id = ? AND content IN (${placeholders})`, [entityId, ...observations] ); }