Skip to main content
Glama

Replace lines

replace_lines
Destructive

Use this when the intended edit target is a specific 1-based line range in one file, optionally as a dry run. Use edit_block for matching an exact text block and write_file for replacing the complete file.

Input Schema

NameRequiredDescriptionDefault
pathYesAbsolute path of the file to edit.
deviceYesReMCP device id returned by list_devices. Required for every device operation.
contentYesReplacement text; an empty string deletes the range.
dry_runNoReturn the diff without changing the file. Default false.
end_lineYesLast line to replace, 1-based and inclusive.
start_lineYesFirst line to replace, 1-based and inclusive.

Output Schema

NameRequiredDescriptionDefault
dataNoOptional structured result data for follow-up reasoning and tool calls.
textYesConcise human-readable result of the tool call.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added
  2. Removed
  3. First observed

TDQS

A4.5/5.0
Behavior4/5

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

Annotations already declare destructiveHint=true and readOnlyHint=false. The description adds the dry-run option and the line-range scoping as behavioral context beyond the annotations. It does not contradict the 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?

Two sentences with the core use case front-loaded and alternatives stated directly. Every word earns its place; no filler or redundancy.

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?

For a simple edit tool with full schema coverage and an output schema, the description includes usage guidance, alternative routing, and dry-run behavior. Nothing essential is missing for an agent to invoke it correctly.

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?

The schema covers all six parameters with clear descriptions, including dry_run, empty-string deletion, and inclusive 1-based line numbers. The description adds no parameter-level detail beyond what the schema already provides, 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?

States a specific verb 'replace' and a precise target: a 1-based line range in a single file. Names sibling tools edit_block and write_file to disambiguate. Clear differentiation from alternatives.

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 provides the condition for use ('when the intended edit target is a specific 1-based line range') and directs to edit_block for text-block matching and write_file for full-file replacement. No ambiguity about when to select it.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources