Skip to main content
Glama

multiedit

Apply multiple old_string to new_string replacements to one file in a single call, sequentially and atomically, with dry-run preview to check changes before writing.

Instructions

Applies multiple old_string -> new_string replacements to a single file in one call. Edits are applied sequentially in order; each edit sees the result of the previous one. Atomic: if any edit fails, the file is not modified at all. Encoding-aware: preserves original file encoding (UTF-8, EUC-KR, Shift-JIS, etc.). Line-ending aware: old_string matches whether the file uses CRLF or LF, and inserted newlines follow the region being edited (mixed-newline files stay intact). Use dry_run=true to preview all changes without modifying the file.

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

Input Schema

NameRequiredDescriptionDefault
pathNoAlias for file_path
editsYesOrdered list of replacements to apply sequentially
dry_runNoPreview changes without modifying the file: true or false. Default: false
encodingNoCharset override, e.g. EUC-KR or CP949; overrides .editorconfig, BOM takes priority
file_pathNoFile to edit. Relative paths use the configured workspace or MCP client root
indent_styleNotabs or spaces-N; default auto-detect, same as edit
expected_hashNoExpected raw-file SHA-256; mismatch rejects the whole batch

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv1.0.5
    • addedInput schema / properties / encoding
      Added value: +{
      +  "description": "Charset override, e.g. EUC-KR or CP949; overrides .editorconfig, BOM takes priority",
      +  "type": "string"
      +}
    • addedInput schema / properties / expected_hash
      Added value: +{
      +  "description": "Expected raw-file SHA-256; mismatch rejects the whole batch",
      +  "type": "string"
      +}
    • addedInput schema / properties / indent_style
      Added value: +{
      +  "description": "tabs or spaces-N; default auto-detect, same as edit",
      +  "type": "string"
      +}
  2. Changed2 schema fields changedv0.9.5
    • addedInput schema / properties / dry_run / type
      Added value: +"boolean"
    • changedInput schema / properties / file_path / description
      Previous value: -"Absolute path to the file to edit"New value: +"File to edit. Relative paths use the configured workspace or MCP client root"
  3. Addedv0.8.7

TDQS

A3.8/5.0
Behavior4/5

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

With no annotations, the description carries the whole burden and does so well: it discloses sequential application order, all-or-nothing atomicity on failure, encoding preservation (UTF-8/EUC-KR/Shift-JIS), and CRLF/LF tolerant matching with region-following newlines. Gaps remain: it does not describe the response returned, how per-edit failures are reported, or dry_run output shape.

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?

The core purpose is front-loaded in sentence one, followed by one behavioral trait per sentence with no filler. Every sentence (ordering, atomicity, encoding, line endings, dry_run) earns its place for a mutation tool.

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 7-parameter mutating tool with no annotations and no output schema, the description covers the risky behavioral surface (atomicity, encoding, line endings, preview) thoroughly. It stops short of explaining expected_hash rejection behavior and the shape of results, which an agent would want before calling.

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 documents path/file_path, encoding, indent_style, expected_hash and dry_run. The description reinforces edit ordering and dry_run preview but adds little meaning beyond the schema's 'Ordered list of replacements to apply sequentially'. Baseline 3 applies when the schema does the heavy lifting.

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 first sentence gives a specific verb and resource: applies multiple old_string -> new_string replacements to a single file in one call. The 'multiple ... in one call' phrasing implicitly separates it from the single-edit sibling, but no sibling is named explicitly. An agent can still tell what it does and roughly how it differs from 'edit'.

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 atomic, sequential nature suggests this is preferable to several single-edit calls, and dry_run is offered for previewing. The description never states when to prefer this over 'edit'/'patch', nor any preconditions such as path requirements or hash checks. Reasonable inference is required.

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