add_observations
Add observations to existing entities in a knowledge graph for remote storage and collaborative memory management.
Instructions
기존 엔티티에 관찰 내용을 추가합니다
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| observations | Yes |
Implementation Reference
- src/index.ts:471-488 (handler)The main MCP tool handler for 'add_observations'. It delegates to memoryManager.addObservations, performs sync if enabled, and returns a success response.private async handleAddObservations(args: any) { this.memoryManager.addObservations(args.observations); const totalObservations = args.observations.reduce((sum: number, obs: any) => sum + obs.contents.length, 0); const commitMessage = `feat: Add ${totalObservations} observations to ${args.observations.length} entities`; await this.syncWithMessage(commitMessage); return { content: [{ type: 'text', text: JSON.stringify({ success: true, message: 'Added observations', observations: args.observations, }, null, 2), }], }; }
- src/index.ts:133-152 (schema)Input schema definition for the 'add_observations' tool, specifying array of observations with entityName and contents.inputSchema: { type: 'object', properties: { observations: { type: 'array', items: { type: 'object', properties: { entityName: { type: 'string' }, contents: { type: 'array', items: { type: 'string' }, }, }, required: ['entityName', 'contents'], }, }, }, required: ['observations'], },
- src/index.ts:130-153 (registration)Tool registration in the ListTools response, including name, description, and input schema.{ name: 'add_observations', description: '기존 엔티티에 관찰 내용을 추가합니다', inputSchema: { type: 'object', properties: { observations: { type: 'array', items: { type: 'object', properties: { entityName: { type: 'string' }, contents: { type: 'array', items: { type: 'string' }, }, }, required: ['entityName', 'contents'], }, }, }, required: ['observations'], }, },
- src/memory-graph.ts:55-67 (helper)Core helper method in MemoryGraphManager that appends new observations to existing entities and updates metadata.addObservations(observations: { entityName: string; contents: string[] }[]): void { const now = new Date().toISOString(); observations.forEach(({ entityName, contents }) => { const entity = this.graph.entities.get(entityName); if (entity) { entity.observations.push(...contents); entity.updatedAt = now; } }); this.updateMetadata(); }