Skip to main content
Glama

add_observations

Add new observations to existing entities in a knowledge graph by specifying entity names and observation contents with a memory file path.

Instructions

Add new observations to existing entities in the knowledge graph

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
observationsYes
memoryFilePathYesThe path to the memory file

Implementation Reference

  • Core handler logic in KnowledgeGraphManager.addObservations: loads graph from file, finds entities, adds unique observations, saves updated graph, returns added observations per entity.
    async addObservations( observations: { entityName: string; contents: string[] }[], filepath: string ): Promise<{ entityName: string; addedObservations: string[] }[]> { await this.setMemoryFilePath(filepath); const graph = await this.loadGraph(); const results = observations.map((o) => { const entity = graph.entities.find((e) => e.name === o.entityName); if (!entity) { throw new Error(`Entity with name ${o.entityName} not found`); } const newObservations = o.contents.filter( (content) => !entity.observations.includes(content) ); entity.observations.push(...newObservations); return { entityName: o.entityName, addedObservations: newObservations }; }); await this.saveGraph(graph); return results; }
  • Input schema definition for the add_observations tool, specifying structure for observations array (with entityName and contents) and memoryFilePath.
    { name: "add_observations", description: "Add new observations to existing entities in the knowledge graph", inputSchema: { type: "object", properties: { observations: { type: "array", items: { type: "object", properties: { entityName: { type: "string", description: "The name of the entity to add the observations to", }, contents: { type: "array", items: { type: "string" }, description: "An array of observation contents to add", }, }, required: ["entityName", "contents"], }, }, memoryFilePath: { type: "string", description: "The path to the memory file", }, }, required: ["observations", "memoryFilePath"], }, },
  • index.ts:634-652 (registration)
    Registration in the tool dispatcher switch statement: handles CallToolRequest for add_observations by calling the KnowledgeGraphManager method and returning JSON-formatted result.
    case "add_observations": return { content: [ { type: "text", text: JSON.stringify( await knowledgeGraphManager.addObservations( args.observations as { entityName: string; contents: string[]; }[], args.memoryFilePath as string ), null, 2 ), }, ], };

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/BRO3886/mcp-memory-custom'

If you have feedback or need assistance with the MCP directory API, please join our Discord server