Skip to main content
Glama
fs-mcp-server

fs-mcp-server

by qsrahman

Edit File

edit_file
Destructive

Make line-based text file edits by replacing exact oldText with newText in order; preview changes via diff and write nothing if any match is ambiguous or missing.

Instructions

Make line-based edits to a text file. Edits apply in order, each replacing oldText with newText. oldText must match exactly one place (include enough surrounding lines to be unique), or set replaceAll to replace every match. Line endings and leading/trailing whitespace on whole lines are ignored when there is no exact match. If any edit has no match or an ambiguous one, nothing is written. Returns a git-style diff.

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

Input Schema

NameRequiredDescriptionDefault
pathYesAbsolute path, or relative to the server's working directory.
editsYesThe replacements to make, applied in order. Each oldText must match exactly one place unless replaceAll is set.
dryRunNoPreview changes using git-style diff format

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.3.0

TDQS

A4/5.0
Behavior4/5

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

Goes well beyond the annotations by disclosing atomicity ("If any edit has no match or an ambiguous one, nothing is written"), the fuzzy-match tolerance for line endings and whitespace, and the git-style diff return. The destructive nature is already covered by destructiveHint=true, so the description's added value is the write semantics and all-or-nothing guarantee rather than safety labeling.

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?

Five short sentences, each carrying distinct information: what it does, ordering, matching rule, fallback mode, tolerance, atomicity, return value. Front-loaded with the verb and no filler.

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 three-parameter mutation tool with no output schema, the description covers ordering, match ambiguity, atomic failure and return format, which is what an agent needs to invoke it correctly. Only the dryRun default and its preview role are left entirely to the schema.

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 path, edits, oldText, newText, replaceAll and dryRun are all documented structurally; baseline is 3. The description reinforces the uniqueness rule for oldText and replaceAll and adds the whitespace/line-ending tolerance hint, but does not define anything the schema leaves unclear.

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?

States a specific verb and resource ("Make line-based edits to a text file") and the line-based/targeted-edit nature immediately separates it from a whole-file write or a read. An agent can tell what this does without opening the schema.

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?

Usage is only implied: the match-uniqueness rule and replaceAll carve out when to use each mode, and the failure-mode sentence tells the agent what happens on a bad match. However, there is no explicit statement of when to pick this over the sibling write_file or a full rewrite, and no prerequisite guidance.

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