delete_observations
Remove specific observations from entities in the Obsidian Memory MCP knowledge graph. Input entity names and observations to delete for precise memory management.
Instructions
Delete specific observations from entities in the knowledge graph
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| deletions | Yes |
Implementation Reference
- Core handler function that implements the deletion of specific observations from entities. It iterates over deletions, loads the entity markdown, removes matching observations, reloads relations, and saves the updated file.async deleteObservations(deletions: { entityName: string; observations: string[] }[]): Promise<void> { for (const del of deletions) { const entityPath = getEntityPath(del.entityName); try { const entity = await this.loadEntity(entityPath); if (!entity) continue; // Remove specified observations entity.observations = entity.observations.filter( obs => !del.observations.includes(obs) ); // Get current relations const graph = await this.loadGraph(); const entityRelations = graph.relations.filter(r => r.from === entity.name); // Save updated entity await this.saveEntity(entity, entityRelations); } catch (error) { throw new Error(`Failed to delete observations from ${del.entityName}: ${error}`); } } }
- index.ts:120-140 (schema)Defines the input schema for the delete_observations tool, specifying the structure of deletions array with entityName and observations.inputSchema: { type: "object", properties: { deletions: { type: "array", items: { type: "object", properties: { entityName: { type: "string", description: "The name of the entity containing the observations" }, observations: { type: "array", items: { type: "string" }, description: "An array of observations to delete" }, }, required: ["entityName", "observations"], }, }, }, required: ["deletions"], },
- index.ts:117-141 (registration)Registers the delete_observations tool in the list of tools returned by ListToolsRequestHandler.{ name: "delete_observations", description: "Delete specific observations from entities in the knowledge graph", inputSchema: { type: "object", properties: { deletions: { type: "array", items: { type: "object", properties: { entityName: { type: "string", description: "The name of the entity containing the observations" }, observations: { type: "array", items: { type: "string" }, description: "An array of observations to delete" }, }, required: ["entityName", "observations"], }, }, }, required: ["deletions"], }, },
- index.ts:220-222 (handler)MCP tool call dispatcher that invokes the storage manager's deleteObservations method and returns success response.case "delete_observations": await storageManager.deleteObservations(args.deletions as { entityName: string; observations: string[] }[]); return { content: [{ type: "text", text: "Observations deleted successfully" }] };