delete_observations
Remove specific observations from entities in a knowledge graph to maintain data accuracy and manage stored information.
Instructions
엔티티에서 특정 관찰 내용을 삭제합니다
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| deletions | Yes |
Implementation Reference
- src/index.ts:509-525 (handler)The primary handler for the 'delete_observations' tool. It delegates deletion to the memory manager, performs optional synchronization with a commit message, and returns a formatted 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 (registration)Tool registration in the MCP server's tool list, including name, description, and detailed input schema for deletions.{ 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:171-190 (schema)Input schema defining the structure for deletions: array of objects with entityName and observations array.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/memory-graph.ts:94-108 (helper)Supporting method in MemoryGraphManager that implements the core logic: filters out specified observations from matching entities and updates metadata.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(); }