delete_observations
Remove specific observations from entities in a knowledge graph to maintain accurate remote memory data for collaborative projects.
Instructions
엔티티에서 특정 관찰 내용을 삭제합니다
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| deletions | Yes |
Implementation Reference
- src/index.ts:509-525 (handler)The primary handler function for the 'delete_observations' tool. It invokes the memory manager to delete the specified observations, optionally performs a sync with a descriptive commit message, and returns a structured success response.private async handleDeleteObservations(args: any) { this.memoryManager.deleteObservations(args.deletions); const totalDeleted = args.deletions.reduce((sum: number, del: any) => sum + del.observations.length, 0); const commitMessage = `feat: Delete ${totalDeleted} observations from ${args.deletions.length} entities`; await this.syncWithMessage(commitMessage); return { content: [{ type: 'text', text: JSON.stringify({ success: true, message: 'Deleted observations', deletions: args.deletions, }, null, 2), }], };
- src/index.ts:168-191 (schema)The input schema for the 'delete_observations' tool, defining the expected structure: an array of deletions, each specifying entityName and observations to delete.{ name: 'delete_observations', description: '엔티티에서 특정 관찰 내용을 삭제합니다', inputSchema: { type: 'object', properties: { deletions: { type: 'array', items: { type: 'object', properties: { entityName: { type: 'string' }, observations: { type: 'array', items: { type: 'string' }, }, }, required: ['entityName', 'observations'], }, }, }, required: ['deletions'], }, },
- src/index.ts:388-389 (registration)Registration of the tool handler in the CallToolRequestSchema switch statement, dispatching calls to handleDeleteObservations.case 'delete_observations': return await this.handleDeleteObservations(args);
- src/memory-graph.ts:94-108 (helper)The underlying helper method in MemoryGraphManager that implements the observation deletion logic by filtering out specified observations from the target entities and updating timestamps.deleteObservations(deletions: { entityName: string; observations: string[] }[]): void { const now = new Date().toISOString(); deletions.forEach(({ entityName, observations }) => { const entity = this.graph.entities.get(entityName); if (entity) { entity.observations = entity.observations.filter( obs => !observations.includes(obs) ); entity.updatedAt = now; } }); this.updateMetadata(); }