Skip to main content
Glama
IzumiSy

MCP DuckDB Knowledge Graph Memory Server

delete_observations

Remove specific observations from entities in the knowledge graph to maintain accurate and up-to-date data within the MCP DuckDB Knowledge Graph Memory Server.

Instructions

Delete specific observations from entities in the knowledge graph

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
deletionsYes

Implementation Reference

  • Core handler function that performs the actual deletion of observations from the SQLite database using transactions, processes each deletion by entity and content, commits changes, updates the Fuse.js search index, and handles errors with rollback.
    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; } }
  • src/server.ts:106-129 (registration)
    MCP server.tool registration for the 'delete_observations' tool, including description, Zod input schema, and thin async handler that delegates to knowledgeGraphManager.deleteObservations and returns success message.
    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 structure: an array of objects each with entityName (string) and contents (array of strings).
    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"), },
  • TypeScript interface defining the KnowledgeGraphManager methods, including deleteObservations signature.
    export type KnowledgeGraphManagerInterface = { createEntities(entities: Entity[]): Promise<Entity[]>; createRelations(relations: Relation[]): Promise<Relation[]>; addObservations(observations: Array<Observation>): Promise<Observation[]>; deleteEntities(entityNames: string[]): Promise<void>; deleteObservations(deletions: Array<Observation>): Promise<void>; deleteRelations(relations: Relation[]): Promise<void>; searchNodes(query: string): Promise<KnowledgeGraph>; openNodes(names: string[]): Promise<KnowledgeGraph>; };

Other Tools

Related Tools

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