Skip to main content
Glama

delete_observations

Remove specific observations from entities by matching exact text, enabling precise data cleanup in the Memento memory server.

Instructions

Remove specific observations from entities by matching text.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
deletionsYesList of {entityName, observations} deletion requests.

Implementation Reference

  • MCP tool handler and registration for 'delete_observations'. Includes input schema validation using Zod and 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' }] }; } );
  • Helper method in KnowledgeGraphManager that resolves entity names to IDs and calls the repository's deleteObservations for each entry.
    async deleteObservations(list) { for (const { entityName, observations } of list) { const entityId = await this.#repository.getEntityId(entityName); if (!entityId) continue; await this.#repository.deleteObservations(entityId, observations); } }
  • SQLite repository implementation of deleteObservations: executes SQL DELETE on observations table matching entity_id and content.
    async 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] ); }
  • PostgreSQL repository implementation of deleteObservations: executes SQL DELETE using ANY array for observations content.
    async deleteObservations(entityId, observations) { if (!observations.length) { return; } await this.#query( `DELETE FROM observations WHERE entity_id = $1 AND content = ANY ($2)`, [ entityId, observations ] ); }
  • Interface definition (JSDoc) for the GraphRepository deleteObservations method.
    * @property {(entityId: number|string, observations: string[]) => Promise<void>} deleteObservations

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/iAchilles/memento'

If you have feedback or need assistance with the MCP directory API, please join our Discord server