Skip to main content
Glama
ellmos-ai

ellmos-filecommander-mcp

String Replace in File

fc_str_replace
Destructive

Replaces a unique string in a file with another. Useful for renaming functions, adding imports, or deleting lines when the target string appears exactly once. Returns an error if zero or multiple occurrences are found.

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=""

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesPath to the file
old_strYesString to replace (must be unique)
new_strNoNew string (empty = delete)
Behavior5/5

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

Beyond annotations (destructiveHint=true), discloses that an error is returned for non-unique occurrences, and that empty new_str deletes the old_str. This is critical behavioral context not captured by annotations.

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?

Highly concise: a brief one-sentence summary then clear args, returns, important note, and examples. Every sentence is essential and front-loaded.

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

Completeness5/5

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

Tool has 3 params with 100% schema coverage, no output schema, but description fully explains behavior, constraints, and return. No gaps exist for correct use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3. But the description adds exceptional value: explains uniqueness constraint for old_str, shows new_str can be empty (delete), and includes realistic examples that clarify parameter usage. This elevates above baseline.

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 it replaces a unique string in a file with another, using specific verbs and resources. It distinguishes from siblings like fc_edit_file and fc_batch_rename by emphasizing uniqueness constraint.

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?

Explicitly states that old_str must occur exactly once, and warns about errors for 0 or >1 occurrences. Provides three practical examples showing when to use it (rename, add import, delete line), which implicitly guides against alternatives.

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/ellmos-ai/ellmos-filecommander-mcp'

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