Skip to main content
Glama
ellmos-filecommander-mcp

ellmos-filecommander-mcp

String Replace in File

fc_str_replace
Destructive

Replaces a unique string in a file with another string, ensuring exact single occurrence and returning an error for zero or multiple matches.

Instructions

Replaces a unique string in a file with another.

Args:

  • path (string): Path to the file

  • old_str (string): String to replace (must occur exactly once)

  • new_str (string): New string (empty = delete)

Returns:

  • Confirmation with context

IMPORTANT: old_str must occur EXACTLY once in the file! An error is returned for 0 or >1 occurrences.

Examples:

  • Rename function: old_str="def old_name", new_str="def new_name"

  • Add import: old_str="import os", new_str="import os\nimport sys"

  • Delete line: old_str="# TODO: remove this\n", new_str=""

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>"
    },
    "name": "fc_str_replace"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYesPath to the file
new_strNoNew string (empty = delete)
old_strYesString to replace (must be unique)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv1.11.5
    • removedInput schema / additionalProperties
      Removed value: -false
  2. Addedv1.9.3
  3. Removedv1.9.3
  4. First observedv1.7.8

TDQS

A3.9/5.0
Behavior4/5

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

Annotations already declare destructiveHint=true and readOnlyHint=false, and the description goes further by explaining the failure mode: an error is returned for 0 or more than 1 occurrences, and an empty new_str performs a delete. It does not cover atomicity, safe-mode interaction, or whether partial writes can occur on failure.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The core sentence and the uniqueness warning are front-loaded, and the examples are compact and illustrative rather than filler. The Args/Returns blocks duplicate the schema, which is mild redundancy but not costly.

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 destructive mutation tool with no output schema, the definition covers the failure condition, the delete case, and gives a rough return expectation ('confirmation with context'). Gaps remain around atomicity, encoding/line-ending handling, and interaction with safe mode, but nothing essential to correct invocation is missing.

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 coverage is 100%, so the schema already documents all three parameters including the 'empty = delete' and uniqueness notes. The description's Args block largely restates the schema; the only genuine addition is the explicit error condition for 0 or >1 matches, which makes it marginally better than baseline.

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?

States a specific verb and resource ('Replaces a unique string in a file') with the key constraint front-loaded. It does not distinguish itself from the similarly-scoped sibling fc_edit_file, so an agent cannot route between the two from the description alone.

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?

Three concrete examples (rename function, add import, delete line) give clear situational context for when this tool is the right choice. It stops short of naming exclusions or pointing to fc_edit_file / fc_write_file as alternatives, so the routing decision remains inferential.

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