Skip to main content
Glama

Edit Memory

edit_memory
Destructive

Replace content in Serena's memory files using literal strings or regex patterns to update stored information efficiently.

Instructions

Replaces content matching a regular expression in a memory.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
memory_file_nameYesThe name of the memory.
needleYesThe string or regex pattern to search for. If `mode` is "literal", this string will be matched exactly. If `mode` is "regex", this string will be treated as a regular expression (syntax of Python's `re` module, with flags DOTALL and MULTILINE enabled).
replYesThe replacement string (verbatim).
modeYesEither "literal" or "regex", specifying how the `needle` parameter is to be interpreted.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

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

Annotations provide readOnlyHint=false and destructiveHint=true, indicating a mutation operation with destructive potential. The description adds valuable context by specifying it's a replacement operation (not just editing) and mentions regex matching, which helps the agent understand the tool's behavior beyond the basic safety profile. No contradiction with annotations exists.

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, front-loaded sentence that efficiently conveys the core functionality without unnecessary words. Every element ('Replaces content matching a regular expression in a memory') serves a clear purpose, 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.

Completeness4/5

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

Given the tool's complexity (regex operations with destructive potential), the description provides adequate context when combined with annotations and schema. However, it doesn't mention side effects like what happens if no match is found or whether changes are reversible, which could be helpful. The presence of an output schema reduces the need to describe return values.

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., 'needle' explains literal vs regex modes with Python re module details). The description doesn't add significant semantic value beyond the schema, as it only mentions 'regular expression' generally without elaborating on parameter interactions or edge cases.

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

Purpose5/5

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

The description clearly states the specific action ('Replaces content') on a specific resource ('in a memory') using a specific method ('matching a regular expression'). It distinguishes from siblings like 'replace_content' (general file replacement) and 'write_memory' (full overwrite) by specifying regex-based partial replacement within memories.

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

Usage Guidelines4/5

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

The description implies usage for regex-based editing of memory content, suggesting when to use it (for pattern-based replacements in memories). However, it doesn't explicitly state when NOT to use it or name specific alternatives like 'write_memory' for complete overwrites or 'replace_content' for non-memory files, leaving some ambiguity about tool selection.

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/chrisgreenx-ctrl/serena'

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