Skip to main content
Glama

delete_memory

Remove a specific stored conversation from the MITM proxy memory system by providing its unique ID, enabling users to manage their conversation history and maintain privacy.

Instructions

Delete a specific memory by ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
memory_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP tool handler for 'delete_memory'. Registers the async function as an MCP tool and implements the logic by delegating to MemoryService.delete_memory, handling errors, and returning a success response.
    @mcp.tool(name="delete_memory", description="Delete a specific memory by ID")
    async def delete_memory(memory_id: str) -> dict[str, str]:
        """
        Permanently delete a specific memory by its ID.
    
        ## When to Use
    
        - User explicitly requests to forget something ("forget about...", "delete that memory")
        - Incorrect or misleading information was stored
        - Outdated memories that are no longer relevant
        - Privacy concerns or sensitive data removal
        - Cleaning up test or temporary memories
    
        ## Example Usage
    
        ```python
        # Delete after finding incorrect memory
        memories = await search_memories("API endpoint")
        # User: "That old endpoint is wrong, delete it"
        await delete_memory("mem_oldid456")
    
        # Delete outdated preference
        # User: "Actually, forget what I said about tabs vs spaces"
        await delete_memory("mem_tabpref789")
        ```
    
        ## Example Response
    
        ```json
        {
            "status": "deleted",
            "memory_id": "mem_oldid456",
            "message": "Memory successfully deleted"
        }
        ```
    
        ⚠️ **Caution**: Deletions are permanent and cannot be undone. Always confirm with the user if you're unsure about deleting a memory.
    
        Args:
            memory_id: The unique memory ID to delete (obtained from search_memories or list_memories)
    
        Returns:
            Confirmation dictionary containing:
            - status: "deleted" on success
            - memory_id: The ID that was deleted
            - message: Confirmation message
        """
        try:
            await memory_service.delete_memory(memory_id=memory_id)
            logger.info("Memory deleted", memory_id=memory_id)
            return {"status": "deleted", "memory_id": memory_id}
        except Exception as e:
            logger.error("Delete failed", error=str(e))
            raise RuntimeError(f"Delete failed: {str(e)}") from e
  • MemoryService.delete_memory method: the core implementation that calls the Mem0 AsyncMemoryClient.delete API to perform the actual memory deletion.
    async def delete_memory(self, memory_id: str) -> dict[str, Any]:
        """Delete a specific memory asynchronously.
    
        Args:
            memory_id: ID of the memory to delete
    
        Returns:
            Deletion response
        """
        try:
            self._logger.info("Deleting memory", memory_id=memory_id)
    
            result = await self.async_client.delete(memory_id=memory_id)
    
            self._logger.info("Memory deleted", memory_id=memory_id)
            return result
    
        except Exception as e:
            self._logger.error(
                "Failed to delete memory", memory_id=memory_id, error=str(e)
            )
            raise
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 deletes a memory, which implies a destructive mutation, but doesn't cover critical aspects like whether deletion is permanent, requires specific permissions, has side effects, or returns confirmation. This leaves significant gaps for a destructive operation.

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, direct sentence with zero wasted words. It's front-loaded with the core action and resource, making it highly efficient and easy to parse. Every word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's destructive nature, no annotations, and an output schema (which should cover return values), the description is minimally adequate but lacks depth. It states what the tool does but omits important context like safety warnings, error conditions, or integration with siblings (e.g., using 'list_memories' first). The presence of an output schema helps but doesn't fully compensate.

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 mentions 'by ID', which adds meaning to the 'memory_id' parameter beyond the schema's minimal coverage (0%). However, it doesn't specify what format the ID should be (e.g., UUID, numeric) or where to obtain it. With one parameter and low schema coverage, this provides some but incomplete compensation.

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 ('Delete') and the resource ('a specific memory by ID'), making the purpose immediately understandable. It doesn't explicitly distinguish from sibling tools like 'list_memories' or 'search_memories', but the verb 'Delete' inherently differentiates it from those read 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., needing a valid memory ID), exclusions (e.g., not for bulk deletion), or suggest alternatives like 'list_memories' to find IDs first. Usage is implied only by the action itself.

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/terrymunro/mcp-mitm-mem0'

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