Skip to main content
Glama
GeminiDesk MCP
by LZ7TOP

Edit File

fs_edit_file

Edits existing text files by replacing an exact string with new content, optionally updating all matching occurrences.

Instructions

对已有文本文件执行精确字符串替换修改。

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>",
      "target": "<target>",
      "replacement": "<replacement>"
    },
    "name": "fs_edit_file"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYes目标文件路径
targetYes需要被替换的原文片段
replaceAllNo是否替换全部匹配项
replacementYes替换后的新内容

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.2.0

TDQS

C2.9/5.0
Behavior2/5

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

No annotations are supplied, so the description carries the full burden. It does not say whether the target must match exactly once, what happens on zero or multiple matches without replaceAll, whether the write is atomic, or how encoding and line endings are treated. For a mutation tool these failure modes are central.

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?

A single short sentence with no wasted words, front-loading the action. It is not padded, though its brevity is part of why behavioral gaps remain.

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

Completeness2/5

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

For a four-parameter destructive edit with no annotations and no output schema, the description should explain matching semantics and error behavior. It covers only the bare intent, leaving the agent unable to predict outcomes when target matches zero or many times.

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%, so every parameter, including replaceAll and its default, is already documented in the schema. The description adds no meaning beyond the schema, which makes the baseline 3 appropriate.

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 states a specific verb and resource: perform an exact string replacement in an existing text file. That distinguishes it from whole-file overwrite tools such as fs_write_file, though it never names any sibling explicitly.

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

Usage Guidelines2/5

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

There is no guidance on when to use this tool rather than fs_write_file, fs_patch_lines or fs_multi_edit. The only hint is that the file must already exist, which is implied by '对已有文本文件' but not framed as a condition.

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