Skip to main content
Glama

Delete Memory

delete_memory
Destructive

Remove outdated or incorrect information from Serena's memory files when users request deletion to maintain accurate project data.

Instructions

Delete a memory file. Should only happen if a user asks for it explicitly, for example by saying that the information retrieved from a memory file is no longer correct or no longer relevant for the project.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
memory_file_nameYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The DeleteMemoryTool class provides the handler for the 'delete_memory' tool. Its apply method executes the tool logic by delegating to the project's memories_manager.delete_memory method.
    class DeleteMemoryTool(Tool, ToolMarkerCanEdit):
        """
        Deletes a memory from Serena's project-specific memory store.
        """
    
        def apply(self, memory_file_name: str) -> str:
            """
            Delete a memory file. Should only happen if a user asks for it explicitly,
            for example by saying that the information retrieved from a memory file is no longer correct
            or no longer relevant for the project.
            """
            return self.memories_manager.delete_memory(memory_file_name)
  • The delete_memory method in MemoriesManager performs the actual file deletion for memories and returns a confirmation message. This is called by the DeleteMemoryTool handler.
    def delete_memory(self, name: str) -> str:
        memory_file_path = self.get_memory_file_path(name)
        memory_file_path.unlink()
        return f"Memory {name} deleted."
Behavior4/5

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

Annotations already indicate destructiveHint=true and readOnlyHint=false, which cover the core safety profile. The description adds valuable context beyond this by emphasizing the need for explicit user consent and providing rationale examples, which helps the agent understand the gravity of the operation. It doesn't detail error conditions or output behavior, but with annotations present, this is sufficient.

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 two sentences that are front-loaded with the core action and immediately followed by critical usage guidelines. Every word serves a purpose, with no redundancy or fluff, making it highly efficient and easy to parse for an AI agent.

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

Completeness4/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, the description effectively complements the annotations by stressing user consent and providing examples. With an output schema present, it doesn't need to explain return values. The combination of clear purpose, strong guidelines, and annotations makes this description sufficiently complete for safe agent 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?

The input schema has 0% description coverage, with only one parameter ('memory_file_name') documented structurally. The description doesn't add any parameter-specific information, such as format examples or constraints. However, with a single parameter and the tool's clear purpose, the baseline of 3 is appropriate as the schema alone provides minimal but adequate coverage.

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 resource ('a memory file'), making the purpose immediately understandable. It distinguishes from sibling tools like 'edit_memory', 'read_memory', and 'write_memory' by specifying deletion rather than modification or retrieval. However, it doesn't explicitly contrast with 'list_memories' or other file-related tools beyond the verb itself.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit guidance on when to use this tool: 'only if a user asks for it explicitly', with concrete examples ('information retrieved from a memory file is no longer correct or no longer relevant for the project'). This clearly defines the appropriate context and helps the agent avoid misuse, especially given the destructive nature implied by the tool name.

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/oraios/serena'

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