Skip to main content
Glama
itseasy21

Knowledge Graph Memory Server

by itseasy21

add_observations

Add new observations to existing entities in a knowledge graph to maintain updated memory across conversations.

Instructions

Add new observations to existing entities in the knowledge graph

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
observationsYes

Implementation Reference

  • The core handler function in KnowledgeGraphManager that executes the add_observations tool logic: loads the graph, adds new unique observations to specified entities, persists changes, and returns results.
    async addObservations(observations: { entityName: string; contents: string[] }[]): Promise<{ entityName: string; addedObservations: string[] }[]> {
      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;
    }
  • The input schema definition for the add_observations tool, specifying the structure of observations array with entityName and contents.
    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"],
          },
        },
      },
      required: ["observations"],
    },
  • index.ts:332-356 (registration)
    Registration of the add_observations tool in the ListToolsRequestSchema handler, including name, description, and input schema.
    {
      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"],
            },
          },
        },
        required: ["observations"],
      },
    },
  • index.ts:518-519 (registration)
    Dispatch/registration in the CallToolRequestSchema switch statement that invokes the handler for add_observations tool calls.
    case "add_observations":
      return { content: [{ type: "text", text: JSON.stringify(await knowledgeGraphManager.addObservations(args.observations as { entityName: string; contents: string[] }[]), null, 2) }] };

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

B3.3/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description must disclose behavioral traits on its own. It only states that it adds observations, without detailing whether observations are appended or replaced, what happens if the entity does not exist (e.g., error or auto-creation), or any other side effects. The tool is clearly a write operation, but critical safety and behavior information is missing.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, concise sentence that immediately conveys the tool's core function. There is no fluff or redundant phrasing, and the primary verb and object are front-loaded. It earns a high score for efficiency.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given that there are no annotations and no output schema, the description must provide comprehensive context on its own. However, it only gives a high-level statement and lacks necessary details about input requirements, validation, error handling, or effect on existing data. This leaves significant gaps in the agent's understanding of the tool's full behavior.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has zero coverage for the top-level parameter, and the description does not compensate by explaining the parameter structure. Although the nested schema properties describe entityName and contents, the description adds no semantic value beyond the schema, and the agent must rely solely on the schema to understand that observations is an array of objects with those fields. This is insufficient given the low schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb 'Add' and identifies the resource 'observations' and the target 'existing entities' within the knowledge graph. This clearly distinguishes it from sibling tools like create_entities (which creates entities) and delete_observations (which removes observations), making the tool's purpose unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies that this tool is used when adding observations to existing entities, but it does not explicitly state when to use it over alternatives or provide any comparison with sibling tools. There is no mention of constraints such as 'only for existing entities' or guidance about creating entities first. Thus, the usage context is implied rather than explicitly outlined.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.