add_observations
Add observations to existing entities in a knowledge graph for remote storage and collaboration.
Instructions
기존 엔티티에 관찰 내용을 추가합니다
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| observations | Yes |
Implementation Reference
- src/memory-graph.ts:55-67 (handler)Core handler function that adds observations to existing entities by appending contents to the entity's observations array and updating the updatedAt timestamp.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(); }
- src/index.ts:471-488 (handler)MCP-specific tool handler for 'add_observations' that invokes the core addObservations method, generates commit message, syncs if enabled, and formats the 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:130-152 (schema)Input schema definition and tool metadata registration for the 'add_observations' tool, specifying the expected structure of observations array with entityName and contents.{ 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/index.ts:384-385 (registration)Tool dispatch/registration in the CallToolRequestSchema switch statement that routes 'add_observations' calls to the handler method.case 'add_observations': return await this.handleAddObservations(args);