Skip to main content
Glama

delete_all_memories

Remove all stored memories for a user, agent, app, or run while preserving the entity structure.

Instructions

Delete every memory in the given user/agent/app/run but keep the entity.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
user_idNoUser scope to delete; defaults to server user.
agent_idNoOptional agent scope to delete.
app_idNoOptional app scope to delete.
run_idNoOptional run scope to delete.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The core handler function for the 'delete_all_memories' tool. It resolves API key and default user, validates inputs using DeleteAllArgs, constructs payload, and calls the Mem0 client's delete_all method.
    def delete_all_memories(
        user_id: Annotated[
            Optional[str], Field(default=None, description="User scope to delete; defaults to server user.")
        ] = None,
        agent_id: Annotated[
            Optional[str], Field(default=None, description="Optional agent scope to delete.")
        ] = None,
        app_id: Annotated[
            Optional[str], Field(default=None, description="Optional app scope to delete.")
        ] = None,
        run_id: Annotated[
            Optional[str], Field(default=None, description="Optional run scope to delete.")
        ] = None,
        ctx: Context | None = None,
    ) -> str:
        """Bulk-delete every memory in the confirmed scope."""
    
        api_key, default_user, _ = _resolve_settings(ctx)
        args = DeleteAllArgs(
            user_id=user_id or default_user,
            agent_id=agent_id,
            app_id=app_id,
            run_id=run_id,
        )
        payload = args.model_dump(exclude_none=True)
        client = _mem0_client(api_key)
        return _mem0_call(client.delete_all, **payload)
  • Pydantic BaseModel schema defining the input arguments for the delete_all_memories tool, used for validation.
    class DeleteAllArgs(BaseModel):
        user_id: Optional[str] = Field(
            None, description="User scope to delete; defaults to server user."
        )
        agent_id: Optional[str] = Field(None, description="Optional agent scope filter.")
        app_id: Optional[str] = Field(None, description="Optional app scope filter.")
        run_id: Optional[str] = Field(None, description="Optional run scope filter.")
  • The @server.tool decorator registers the delete_all_memories function as an MCP tool with its description.
    @server.tool(
        description="Delete every memory in the given user/agent/app/run but keep the entity."
    )
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 destructive action ('Delete every memory') and clarifies that entities are preserved ('keep the entity'), which is useful. However, it lacks critical details: no mention of permissions required, irreversibility, confirmation prompts, rate limits, or what the output schema returns. For a high-impact deletion tool, this is insufficient.

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 front-loads the core action ('Delete every memory') and adds clarifying context ('but keep the entity'). There is zero waste or redundancy, making it highly concise and well-structured for quick comprehension.

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 high complexity (destructive bulk deletion) and lack of annotations, the description is incomplete. It covers the basic action and entity preservation but omits safety warnings, permissions, irreversibility, and output details. The presence of an output schema helps, but the description should do more to contextualize this risky operation.

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%, with each parameter well-documented in the schema (e.g., 'User scope to delete; defaults to server user'). The description adds no parameter-specific details beyond implying scoping ('in the given user/agent/app/run'), which the schema already covers. Baseline 3 is appropriate as the schema does the heavy lifting.

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 every memory') and the target resource ('in the given user/agent/app/run'), which is specific and actionable. It distinguishes from siblings like 'delete_memory' (singular) and 'delete_entities' (different resource). However, it doesn't explicitly contrast with all siblings (e.g., 'search_memories' for finding vs. deleting).

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' (for single deletions) or 'delete_entities' (for different resources). It mentions keeping the entity, but doesn't clarify when bulk deletion is appropriate or warn against misuse. No explicit when/when-not instructions are included.

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/parthshr370/mem0_mcp_private'

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