Skip to main content
Glama

add_entity_observation

Enhance entity records by appending observations in SourceSage MCP server. Input entity name and observation to dynamically update and store contextual data for efficient retrieval and analysis.

Instructions

Add an observation to an entity.

Args: entity_name: Name of the entity observation: Observation to add

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
entity_nameYes
observationYes

Implementation Reference

  • The handler function decorated with @self.mcp.tool(), which registers and implements the add_entity_observation tool. It locates the entity by name and delegates to KnowledgeGraph.add_observation.
    def add_entity_observation(entity_name: str, observation: str) -> str:
        """Add an observation to an entity.
    
        Args:
            entity_name: Name of the entity
            observation: Observation to add
        """
        # Find entity by name
        entities = self.knowledge.find_entity(entity_name)
    
        if not entities:
            return f"Error: Entity '{entity_name}' not found"
    
        # If multiple entities with the same name, use the first one
        entity_id = entities[0].entity_id
    
        success = self.knowledge.add_observation(entity_id, observation)
    
        if not success:
            return f"Error: Failed to add observation to entity '{entity_name}'"
    
        # Save knowledge if storage path is set
        if self.storage_path:
            self.knowledge.save_to_file(self.storage_path)
    
        return f"Observation added to entity '{entity_name}'"
  • Supporting method in KnowledgeGraph class that adds a unique observation to an entity's observations list and updates the timestamp.
    def add_observation(self, entity_id: str, observation: str) -> bool:
        """Add an observation to an entity.
    
        Args:
            entity_id: The ID of the entity
            observation: The observation to add
    
        Returns:
            True if successful, False otherwise
        """
        if entity_id not in self.entities:
            return False
    
        entity = self.entities[entity_id]
    
        if observation not in entity.observations:
            entity.observations.append(observation)
            entity.updated_at = time.time()
    
        return True
  • The function signature defines the input schema (entity_name: str, observation: str) and output (str) for the tool, used by MCP for validation.
    """Add an observation to an entity.
  • The @self.mcp.tool() decorator registers the add_entity_observation function as an MCP tool.
    def add_entity_observation(entity_name: str, observation: str) -> str:
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool adds an observation but doesn't explain what that entails—whether it's a mutable update, requires specific permissions, has side effects, or returns any confirmation. For a mutation tool with zero annotation coverage, this leaves critical behavioral traits unspecified.

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

Conciseness4/5

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

The description is front-loaded with the core purpose in the first sentence, followed by a structured 'Args' section. It's appropriately sized with no wasted words, though the lack of additional context (like usage guidelines) might make it feel slightly under-specified rather than concise.

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 the tool's complexity (a mutation operation with 2 parameters), lack of annotations, and no output schema, the description is incomplete. It doesn't cover behavioral aspects (e.g., success/failure responses, side effects), usage context, or parameter details beyond basic names, leaving gaps for an AI agent to operate effectively.

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?

The description includes an 'Args' section that names and briefly describes both parameters ('entity_name' and 'observation'), adding meaning beyond the input schema, which has 0% description coverage. However, it doesn't elaborate on format constraints (e.g., what constitutes a valid entity name or observation), so it only partially compensates for the schema's lack of descriptions.

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 an observation') and the target ('to an entity'), providing a specific verb+resource combination. However, it doesn't differentiate this tool from sibling tools like 'register_entity' or 'get_entity_details', which might handle similar entity-related operations.

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., whether the entity must already exist), exclusions, or relationships to sibling tools like 'register_entity' (which might create entities) or 'query_entities' (which might retrieve them).

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/sarathsp06/sourcesage'

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