Skip to main content
Glama
knowledge-mcp

knowledge-mcp

by kvmadden

Replace text in memory file

memory.str_replace

Replace one exact occurrence of old text with new text in a memory file, with the resulting content screened before writing to keep sensitive values out.

Instructions

Replace a unique occurrence of old_str with new_str. The resulting file content is screened before the write.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "path": "<path>",
      "old_str": "<old_str>",
      "new_str": "<new_str>"
    },
    "name": "memory.str_replace"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYesPath under /memories.
new_strYesReplacement text.
old_strYesExact text to replace; must occur once.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.6/5.0
Behavior3/5

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

Beyond the annotations' mutation and non-destructive signals, the description adds the useful fact that the resulting file content is screened before writing. It does not explain what screening checks, whether a write can be rejected, or what happens on failure, so the added behavioral context remains limited.

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 operation and uniqueness constraint are front-loaded in a compact first sentence, followed by one relevant pre-write behavior. There is no filler or unnecessary repetition.

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?

For a simple three-parameter edit tool, the description, complete schema, and annotations provide enough information to construct a valid invocation. Explicit alternative-selection guidance and more detail about screening or failure behavior would make it more complete.

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%, and the schema already documents the path scope, exact matching, uniqueness requirement, and replacement text. The description restates the roles of old_str and new_str without adding further matching, formatting, or escaping guidance.

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 a targeted replacement of one occurrence of old_str with new_str, and the title establishes that the resource is a memory file. It does not distinguish this editing operation from sibling tools such as memory.insert or memory.create.

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

Usage Guidelines3/5

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

The unique-occurrence requirement implies that this tool is for a precise edit where old_str matches exactly once. However, there is no explicit when-not guidance or direction to an alternative for additions, new files, or ambiguous matches.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.