Skip to main content
Glama
AgentWong

IAC Memory MCP Server

by AgentWong

update_entity

Modify existing Infrastructure-as-Code entities by updating their properties and adding new observations to maintain accurate IaC documentation.

Instructions

Update an existing entity's properties and add new observations

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesEntity ID
nameNoNew name
typeNoNew type
observationNoNew observation

Implementation Reference

  • MCP tool handler for update_entity: validates, logs, calls execute_update_entity, handles errors.
    async def handle_update_entity(db: Any, arguments: Dict[str, Any], operation_id: str) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]:
        """Handle update_entity tool."""
        try:
            logger.info(
                "Updating entity",
                extra={
                    "entity_id": arguments.get("entity_id"),
                    "operation_id": operation_id,
                },
            )
    
            # Execute update
            return execute_update_entity(db, arguments)
    
        except Exception as e:
            error_msg = f"Failed to update entity: {str(e)}"
            logger.error(error_msg, extra={"operation_id": operation_id})
            raise McpError(
                types.ErrorData(
                    code=types.INTERNAL_ERROR,
                    message=error_msg,
                    data={
                        "tool": "update_entity",
                        "operation_id": operation_id,
                    },
                )
            )
  • Tool registration mapping 'update_entity' to its handler function.
    entity_tool_handlers = {
        "create_entity": handle_create_entity,
        "update_entity": handle_update_entity,
        "delete_entity": handle_delete_entity,
        "view_relationships": handle_view_relationships,
    }
  • JSON schema defining input parameters for the update_entity tool.
    "update_entity": {
        "type": "object",
        "description": "Update an existing entity's properties and add new observations",
        "required": ["id"],
        "properties": {
            "id": {"type": "string", "description": "Entity ID"},
            "name": {"type": "string", "description": "New name"},
            "type": {"type": "string", "description": "New type"},
            "observation": {"type": "string", "description": "New observation"},
        },
    },
  • Core execution logic: prepares updates, calls low-level update_entity, adds observation, returns result.
    def execute_update_entity(
        db: DatabaseManager, arguments: Dict[str, Any]
    ) -> List[TextContent]:
        """Execute update entity operation."""
        logger.info("Updating entity", extra={"args": arguments})
    
        updates = {k: v for k, v in arguments.items() if k != "id"}
        success = update_entity(db, arguments["id"], updates)
        if not success:
            raise DatabaseError(f"Entity not found: {arguments['id']}")
    
        # Add observation if provided
        if "observation" in arguments:
            with db.get_connection() as conn:
                conn.execute(
                    "INSERT INTO observations (entity_id, content) VALUES (?, ?)",
                    (arguments["id"], arguments["observation"]),
                )
    
        return [TextContent(type="text", text=f"Updated entity {arguments['id']}")]
  • Low-level database update function for entity properties.
    def update_entity(db: DatabaseManager, entity_id: str, updates: Dict) -> bool:
        """Update an existing entity."""
        set_clause = ", ".join(f"{k} = ?" for k in updates.keys())
        values = tuple(updates.values()) + (entity_id,)
        query = f"UPDATE entities SET {set_clause} WHERE id = ?"
        try:
            with db.get_connection() as conn:
                cursor = conn.execute(query, values)
                return cursor.rowcount > 0
        except sqlite3.Error as e:
            raise DatabaseError(f"Update failed: {str(e)}")
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 states the tool updates properties and adds observations, implying mutation, but doesn't address critical aspects like permission requirements, whether changes are reversible, error handling for invalid IDs, or how observations are appended versus replaced. This leaves significant gaps for an agent to understand the tool's behavior safely.

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 directly states the tool's function without unnecessary words. It's front-loaded with the core action and avoids redundancy, making it easy to parse quickly while conveying essential information.

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 insufficient. It doesn't explain what happens on success or failure, how observations are stored, or the impact on related entities. Given the complexity of updating an entity with observations and the lack of structured behavioral data, more context is needed for safe and effective use.

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 four parameters (id, name, type, observation) with clear descriptions. The description adds no additional meaning beyond what's in the schema, such as explaining relationships between parameters or usage nuances. This meets the baseline for high schema coverage but doesn't enhance parameter understanding.

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 ('Update') and target ('an existing entity's properties and add new observations'), making the purpose understandable. However, it doesn't differentiate this tool from its sibling 'create_entity' or other update tools like 'update_collection_version', leaving room for confusion about when to use this specific entity update tool versus alternatives.

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_entity' for new entities or other update tools for different resources. It mentions updating 'an existing entity' but doesn't clarify prerequisites, exclusions, or specific contexts where this tool is preferred over other options in the sibling list.

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

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/AgentWong/iac-memory-mcp-server'

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