delete_observations
Remove specific observations from entities in your Obsidian knowledge graph to maintain accurate and organized AI memories.
Instructions
Delete specific observations from entities in the knowledge graph
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| deletions | Yes |
Implementation Reference
- Core implementation of the delete_observations tool. Loads the target entity, removes the specified observations from its list, retrieves current outgoing relations for context, and saves the updated markdown 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)Input schema defining the expected parameters: an array of objects each specifying entityName and the observations to delete.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-142 (registration)Registers the delete_observations tool in the ListTools response, providing name, description, and schema.{ 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 (helper)Dispatcher in the CallToolRequestSchema handler that invokes the storageManager.deleteObservations method with parsed arguments 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" }] };