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
| Name | Required | Description | Default |
|---|---|---|---|
| deletions | Yes | ||
| memoryFilePath | Yes | The path to the memory file |
Implementation Reference
- index.ts:188-203 (handler)The handler function in KnowledgeGraphManager that deletes specific observations from the specified entities in the knowledge graph by loading the graph, filtering out the observations, and saving the updated graph.async deleteObservations( deletions: { entityName: string; observations: string[] }[], filepath: string ): Promise<void> { await this.setMemoryFilePath(filepath); const graph = await this.loadGraph(); deletions.forEach((d) => { const entity = graph.entities.find((e) => e.name === d.entityName); if (entity) { entity.observations = entity.observations.filter( (o) => !d.observations.includes(o) ); } }); await this.saveGraph(graph); }
- index.ts:455-487 (schema)Input schema definition for the delete_observations tool, specifying the structure of deletions array and memoryFilePath.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"], }, }, memoryFilePath: { type: "string", description: "The path to the memory file", }, }, required: ["deletions", "memoryFilePath"], }, },
- index.ts:661-668 (registration)Registration of the tool handler in the CallToolRequestSchema switch statement, dispatching to the KnowledgeGraphManager.deleteObservations method.case "delete_observations": await knowledgeGraphManager.deleteObservations( args.deletions as { entityName: string; observations: string[] }[], args.memoryFilePath as string ); return { content: [{ type: "text", text: "Observations deleted successfully" }], };