Skip to main content
Glama
YuNaga224

Obsidian Memory MCP

by YuNaga224

add_observations

Add observations to entities in your knowledge graph to expand and update stored information for visualization in Obsidian.

Instructions

Add new observations to existing entities in the knowledge graph

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
observationsYes

Implementation Reference

  • Core handler function that implements the add_observations tool logic: loads entity, filters duplicates, appends new observations, reloads relations, and saves the updated markdown file for each entity.
    async addObservations(observations: { entityName: string; contents: string[] }[]): Promise<{ entityName: string; addedObservations: string[] }[]> {
      const results: { entityName: string; addedObservations: string[] }[] = [];
      
      for (const obs of observations) {
        const entityPath = getEntityPath(obs.entityName);
        
        try {
          // Load current entity
          const entity = await this.loadEntity(entityPath);
          if (!entity) {
            throw new Error(`Entity ${obs.entityName} not found`);
          }
          
          // Filter out duplicate observations
          const newObservations = obs.contents.filter(
            content => !entity.observations.includes(content)
          );
          
          if (newObservations.length > 0) {
            // Update entity
            entity.observations.push(...newObservations);
            
            // Get current relations for this entity
            const graph = await this.loadGraph();
            const entityRelations = graph.relations.filter(r => r.from === entity.name);
            
            // Save updated entity
            await this.saveEntity(entity, entityRelations);
            
            results.push({
              entityName: obs.entityName,
              addedObservations: newObservations
            });
          }
        } catch (error) {
          throw new Error(`Failed to add observations to ${obs.entityName}: ${error}`);
        }
      }
      
      return results;
    }
  • Input schema defining the structure for add_observations tool: array of objects with entityName (string) and contents (array of strings).
    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:77-101 (registration)
    Tool registration in the ListTools response, 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"],
      },
    },
  • MCP server dispatch handler for add_observations tool call, which invokes the storage manager method and formats the response.
    case "add_observations":
      return { content: [{ type: "text", text: JSON.stringify(await storageManager.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.