Skip to main content
Glama
drdee

Memory MCP

by drdee

update_memory

Modify existing memory entries by updating titles or content using the provided memory ID. Designed for precise memory management within the Memory MCP server.

Instructions

Update an existing memory.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentNoOptional new content for the memory
memory_idYesThe ID of the memory to update
titleNoOptional new title for the memory

Implementation Reference

  • The primary handler function for the 'update_memory' tool. It validates inputs, calls the database update method, and returns a user-friendly success or error message.
    def update_memory(
        memory_id: int, title: Optional[str] = None, content: Optional[str] = None
    ) -> str:
        """
        Update an existing memory.
    
        Args:
            memory_id: The ID of the memory to update
            title: Optional new title for the memory
            content: Optional new content for the memory
    
        Returns:
            A confirmation message
        """
        try:
            if title is None and content is None:
                return (
                    "Error: Please provide at least one field to update (title or content)."
                )
    
            success = db.update_memory(memory_id, title, content)
            if success:
                return f"Memory {memory_id} updated successfully."
            return f"Memory with ID {memory_id} not found."
        except Exception as e:
            return f"Error updating memory: {str(e)}"
  • The schema definition for the 'update_memory' tool, registered in the list_tools handler, specifying input parameters and requirements.
    types.Tool(
        name="update_memory",
        description="Update an existing memory.",
        inputSchema={
            "type": "object",
            "properties": {
                "memory_id": {
                    "type": "integer",
                    "description": "The ID of the memory to update",
                },
                "title": {
                    "type": "string",
                    "description": "Optional new title for the memory",
                },
                "content": {
                    "type": "string",
                    "description": "Optional new content for the memory",
                },
            },
            "required": ["memory_id"],
            "title": "updateMemoryArguments",
        },
    ),
  • The dispatch handler within the generic call_tool function that routes 'update_memory' calls to the specific update_memory implementation.
    elif name == "update_memory":
        if not arguments or "memory_id" not in arguments:
            raise ValueError("Missing memory_id argument")
        memory_id = int(arguments["memory_id"])
        title = arguments.get("title")
        content = arguments.get("content")
        result = update_memory(memory_id, title, content)
        return [types.TextContent(type="text", text=result)]
  • Low-level DatabaseManager helper method that executes the SQL UPDATE on the memories table.
    def update_memory(
        self, memory_id: int, title: Optional[str] = None, content: Optional[str] = None
    ) -> bool:
        """Update an existing memory's title or content."""
        if not self.conn:
            self.initialize_db()
    
        if self.conn is None:
            raise RuntimeError("Database connection not available")
    
        # First check if the memory exists
        existing_memory = self.get_memory_by_id(memory_id)
        if not existing_memory:
            return False
    
        # Build update query
        update_items = []
        params: List[Any] = []
    
        if title is not None:
            update_items.append("title = ?")
            params.append(title)
    
        if content is not None:
            update_items.append("content = ?")
            params.append(content)
    
        if not update_items:
            return True  # Nothing to update
    
        # Add updated_at timestamp
        update_items.append("updated_at = ?")
        params.append(datetime.datetime.now().isoformat())
    
        # Add memory_id to params
        params.append(memory_id)
    
        # Execute update
        self.conn.execute(
            f"UPDATE memories SET {', '.join(update_items)} WHERE id = ?", params
        )
        self.conn.commit()
        return True
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool updates an existing memory but doesn't clarify whether this is a destructive operation, what permissions are required, how conflicts are handled, or what the response looks like. For a mutation tool with zero annotation coverage, this is a significant gap in transparency.

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 with zero waste. It's appropriately sized and front-loaded, directly stating the tool's purpose without unnecessary elaboration. Every word earns its place, making it easy for an agent to parse quickly.

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 no annotations and no output schema), the description is incomplete. It doesn't explain what 'update' entails (e.g., partial vs. full updates), error conditions, or return values. For a tool that modifies data, more context is needed to ensure correct usage 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 (memory_id, content, title) with their types and optionality. The description adds no additional meaning beyond the schema, such as format constraints or usage examples. Baseline 3 is appropriate when the schema does the heavy lifting.

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

Purpose3/5

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

The description 'Update an existing memory' clearly states the verb (update) and resource (memory), but it's vague about what constitutes a 'memory' and doesn't differentiate from sibling tools like 'remember' or 'delete_memory'. It's better than a tautology but lacks specificity about the update operation's scope.

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 'delete_memory' or 'remember'. It doesn't mention prerequisites (e.g., needing an existing memory ID) or contextual cues for choosing this tool over others. The absence of usage instructions leaves the agent without decision-making help.

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/drdee/memory-mcp'

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