Skip to main content
Glama
modelcontextprotocol

Knowledge Graph Memory Server

add_observations

Enhance entities in the Knowledge Graph Memory Server by appending new observations. Input entity names and associated observations to update and expand stored information efficiently.

Instructions

Add new observations to existing entities in the knowledge graph

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
observationsYes

Implementation Reference

  • Core handler implementing the logic to add unique new observations to existing entities in the knowledge graph.
    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;
    }
  • Registers the add_observations tool with the MCP server, providing title, description, input/output schemas, and a handler that delegates to KnowledgeGraphManager.addObservations.
    server.registerTool(
      "add_observations",
      {
        title: "Add Observations",
        description: "Add new observations to existing entities in the knowledge graph",
        inputSchema: {
          observations: z.array(z.object({
            entityName: z.string().describe("The name of the entity to add the observations to"),
            contents: z.array(z.string()).describe("An array of observation contents to add")
          }))
        },
        outputSchema: {
          results: z.array(z.object({
            entityName: z.string(),
            addedObservations: z.array(z.string())
          }))
        }
      },
      async ({ observations }) => {
        const result = await knowledgeGraphManager.addObservations(observations);
        return {
          content: [{ type: "text" as const, text: JSON.stringify(result, null, 2) }],
          structuredContent: { results: result }
        };
      }
    );
  • Tool metadata including title, description, and Zod-based input/output schemas for validation.
    {
      title: "Add Observations",
      description: "Add new observations to existing entities in the knowledge graph",
      inputSchema: {
        observations: z.array(z.object({
          entityName: z.string().describe("The name of the entity to add the observations to"),
          contents: z.array(z.string()).describe("An array of observation contents to add")
        }))
      },
      outputSchema: {
        results: z.array(z.object({
          entityName: z.string(),
          addedObservations: z.array(z.string())
        }))
      }
    },
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. While 'Add new observations' implies a write/mutation operation, it doesn't disclose important behavioral traits like permission requirements, whether this operation is idempotent, what happens if entities don't exist, or any rate limits. The description is minimal and lacks crucial operational context.

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 extremely concise - a single sentence that gets straight to the point with zero wasted words. It's front-loaded with the core functionality and efficiently communicates the basic purpose without unnecessary elaboration.

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?

For a mutation tool with no annotations, 0% schema description coverage, no output schema, and complex nested parameters, the description is inadequate. It doesn't explain what constitutes an 'observation', how they're structured, what the operation returns, or any error conditions. The minimal description leaves too many unanswered questions for effective tool use.

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?

With 0% schema description coverage and 1 parameter (which contains nested objects), the description provides no information about parameters beyond what's implied by the tool name. It doesn't explain what 'observations' should contain, the format expected, or how the 'entityName' parameter relates to existing entities. The description fails to compensate for the complete lack of schema documentation.

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

Purpose4/5

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

The description clearly states the action ('Add new observations') and target ('to existing entities in the knowledge graph'), providing a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools like 'create_entities' or 'delete_observations', which would require more specific scope definition.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like 'create_entities' or 'delete_observations'. It mentions 'existing entities' which implies a prerequisite, but doesn't specify when this operation is appropriate versus creating new entities or modifying other aspects of the graph.

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

Install Server

Other Tools

Related Tools

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/modelcontextprotocol/knowledge-graph-memory-server'

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