Skip to main content
Glama

replace_lines

Replaces a specified line range in a file with new text, supporting insertion before a line by setting end_line to start_line minus one.

Instructions

Replace lines start_line..end_line (1-based, inclusive) with new_text. Use end_line=start_line-1 to insert before start_line.

Input Schema

NameRequiredDescriptionDefault
pathYes
dry_runNo
end_lineYes
new_textYes
start_lineYes

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

B3.3/5.0
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It discloses the inclusive 1-based range semantics, which is valuable, but does not state that this mutates the file on disk, how existing content is affected, whether the file must exist, or what dry_run does.

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 short sentences, no filler, and the core range semantics are front-loaded before the insert edge case. Every sentence earns its place.

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?

Output schema exists, so return values need not be explained, and the range semantics are covered. But for a mutation tool with zero annotation coverage and 0% schema parameter descriptions, the missing dry_run explanation and file-state assumptions leave real gaps.

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 coverage is 0%, so the description must compensate, and it does explain start_line/end_line semantics and the insert trick. However, it says nothing about path or the dry_run flag, leaving two of five parameters — including a behaviorally important one — undocumented anywhere.

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 (replace) and resource (a line range in a file) and clarifies the 1-based inclusive indexing, so the operation itself is unambiguous. It does not differentiate from siblings like edit_file or edit_file_multi, leaving the agent to infer when line-range replacement is preferred.

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?

It gives one concrete usage rule — end_line=start_line-1 to insert before start_line — which is helpful edge-case guidance. But it provides no context on when to choose this over edit_file/edit_file_multi, no prerequisites (e.g. file must exist), and no mention of the dry_run option.

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