Skip to main content
Glama
j3k0

Elasticsearch Knowledge Graph for MCP

by j3k0

add_observations

Update entities by adding observations to their data in the Elasticsearch Knowledge Graph, enhancing the memory-like storage and retrieval for AI models.

Instructions

Add observations to an existing entity in knowledge graph (memory)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
memory_zoneYesOptional memory zone where the entity is stored. If not specified, uses the default zone.
nameYesName of entity to add observations to
observationsYesObservations to add to the entity

Implementation Reference

  • Input schema definition for the add_observations tool, defining parameters: name (string), observations (array of strings), memory_zone (string, required).
    {
      name: "add_observations",
      description: "Add observations to an existing entity in knowledge graph (memory)",
      inputSchema: {
        type: "object",
        properties: {
          name: {
            type: "string",
            description: "Name of entity to add observations to"
          },
          observations: {
            type: "array",
            items: {type: "string"},
            description: "Observations to add to the entity"
          },
          memory_zone: {
            type: "string",
            description: "Optional memory zone where the entity is stored. If not specified, uses the default zone."
          }
        },
        required: ["memory_zone", "name", "observations"],
        additionalProperties: false,
        "$schema": "http://json-schema.org/draft-07/schema#"
      }
    },
  • MCP server tool handler for 'add_observations': validates entity exists, calls kgClient.addObservations, returns formatted success/error response.
    else if (toolName === "add_observations") {
      const name = params.name;
      const observations = params.observations;
      const zone = params.memory_zone;
      
      // Get existing entity
      const entity = await kgClient.getEntity(name, zone);
      if (!entity) {
        const zoneMsg = zone ? ` in zone "${zone}"` : "";
        return formatResponse({
          success: false,
          error: `Entity "${name}" not found${zoneMsg}`,
          message: "Please create the entity before adding observations."
        });
      }
      
      // Add observations to the entity
      const updatedEntity = await kgClient.addObservations(name, observations, zone);
      
      return formatResponse({
        success: true,
        entity: updatedEntity
      });
    }
  • Core implementation: fetches existing entity using getEntity, appends new observations, saves updated entity via saveEntity, returns the updated ESEntity.
    async addObservations(name: string, observations: string[], zone?: string): Promise<ESEntity> {
      const actualZone = zone || this.defaultZone;
      
      // Get existing entity
      const entity = await this.getEntity(name, actualZone);
      if (!entity) {
        throw new Error(`Entity "${name}" not found in zone "${actualZone}"`);
      }
      
      // Add new observations to the existing ones
      const updatedObservations = [
        ...entity.observations,
        ...observations
      ];
      
      // Update the entity
      const updatedEntity = await this.saveEntity({
        name: entity.name,
        entityType: entity.entityType,
        observations: updatedObservations,
        relevanceScore: entity.relevanceScore
      }, actualZone);
      
      return updatedEntity;
    }
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. It implies a write operation ('Add') but doesn't specify permissions needed, whether changes are reversible, rate limits, or what happens if the entity doesn't exist. This is a significant gap for a mutation tool with zero annotation coverage.

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, efficient sentence that front-loads the core purpose without unnecessary words. Every part earns its place by clarifying the action, target, and context ('knowledge graph (memory)'), making it highly concise and well-structured.

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 and no output schema, the description is incomplete. It lacks critical context such as error handling, response format, or behavioral details (e.g., idempotency, side effects), which are essential for safe and effective tool invocation by an AI agent.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already documents all three parameters thoroughly. The description adds no additional meaning beyond what's in the schema (e.g., it doesn't explain observation format or memory zone implications), meeting the baseline for high coverage.

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 observations') and target ('to an existing entity in knowledge graph (memory)'), providing a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools like 'update_entities' or 'mark_important', which might also modify entities, so it doesn't reach the highest score.

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. It doesn't mention prerequisites (e.g., entity must exist), exclusions, or compare to siblings like 'update_entities' or 'create_entities', leaving the agent with no usage context beyond the basic purpose.

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/j3k0/mcp-brain-tools'

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