Skip to main content
Glama
IzumiSy

MCP DuckDB Knowledge Graph Memory Server

delete_observations

Remove specific observations from entities in a knowledge graph to maintain accurate and relevant data.

Instructions

Delete specific observations from entities in the knowledge graph

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
deletionsYesAn array of observation deletions

Implementation Reference

  • Handler function for the delete_observations tool that calls the knowledge graph manager to perform the deletion and returns a success message.
    async ({ deletions }) => { await knowledgeGraphManager.deleteObservations(deletions); return { content: [{ type: "text", text: "Observations deleted successfully" }], }; }
  • src/server.ts:106-129 (registration)
    Registration of the delete_observations MCP tool including description, input schema, and handler reference.
    server.tool( "delete_observations", "Delete specific observations from entities in the knowledge graph", { deletions: z .array( z.object({ entityName: z .string() .describe("The name of the entity containing the observations"), contents: z .array(z.string()) .describe("An array of observations to delete"), }) ) .describe("An array of observation deletions"), }, async ({ deletions }) => { await knowledgeGraphManager.deleteObservations(deletions); return { content: [{ type: "text", text: "Observations deleted successfully" }], }; } );
  • Zod schema defining the input for delete_observations: array of objects with entityName and contents.
    { deletions: z .array( z.object({ entityName: z .string() .describe("The name of the entity containing the observations"), contents: z .array(z.string()) .describe("An array of observations to delete"), }) ) .describe("An array of observation deletions"), },
  • Core implementation of observation deletion in KnowledgeGraphManager: performs SQL deletes in transaction and updates search index.
    async deleteObservations(deletions: Array<Observation>): Promise<void> { using conn = await this.getConn(); try { // Begin transaction await conn.execute("BEGIN TRANSACTION"); // Process each deletion for (const deletion of deletions) { // If there are observations to delete if (deletion.contents.length > 0) { for (const content of deletion.contents) { await conn.execute( "DELETE FROM observations WHERE entityName = ? AND content = ?", [deletion.entityName, content] ); } } } // Commit transaction await conn.execute("COMMIT"); // Update Fuse.js index const allEntities = await this.getAllEntities(); this.fuse.setCollection(allEntities); } catch (error: unknown) { // Rollback in case of error await conn.execute("ROLLBACK"); this.logger.error("Error deleting observations", extractError(error)); throw error; } }
  • Type definition for the deleteObservations method in KnowledgeGraphManagerInterface.
    deleteObservations(deletions: Array<Observation>): Promise<void>;

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/IzumiSy/mcp-duckdb-memory-server'

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