Skip to main content
Glama

edit_file

Replace exact text occurrences in an existing file, updating open VS Code tabs with undo support and saving changes immediately to disk.

Instructions

Edit an existing file by replacing exact occurrences of Target with Replacement. Updates open VS Code tabs cleanly with Undo support and saves immediately to disk.

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

Input Schema

NameRequiredDescriptionDefault
PathYesThe absolute path of the file to modify.
TargetYesThe exact character-sequence to be replaced, including whitespace. Every occurrence is replaced.
ReplacementYesThe content to replace Target with. Leave empty to delete Target.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.7/5.0
Behavior3/5

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

With no annotations supplied, the description carries the full disclosure burden, and it does add real value: the change is applied to open VS Code tabs, is undoable, and is persisted immediately to disk. What is missing is the failure contract — whether a non-matching Target errors out or silently does nothing, and what happens with encoding or read-only files.

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?

Two sentences, zero filler, and the core mechanism is front-loaded before the editor/persistence details. Every clause carries information an agent would otherwise have to guess.

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

Completeness3/5

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

For a simple 3-parameter mutation with no output schema, the description covers what the tool does and its side effects (editor sync, undo, immediate save). It falls short on error behavior when Target is absent and on whether a partial/zero-match result is reported, which matters for a mutation tool with no annotations.

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 the schema already explains Path, Target, and Replacement in detail, including the every-occurrence and empty-Replacement behavior. The description adds no parameter meaning beyond that, so the baseline of 3 applies.

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 gives a specific verb ("Edit") plus resource ("existing file") and the exact mechanism ("replacing exact occurrences of Target with Replacement"). That mechanism is what separates it from write_file (whole-file write) and read_file without needing to name them.

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: "Edit an existing file" suggests this is for modifying a file that already exists rather than creating one, which points away from write_file. There is no explicit when-to-use/when-not-to-use statement, no mention of what to do if the file does not exist, and no named alternative for whole-file rewrites.

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