Skip to main content
Glama

replace_lines

Replace an inclusive line range in a file with new text, or insert text before a line by setting the end line one less than the start.

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.2.1

TDQS

A3.5/5.0
Behavior3/5

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

Annotations already declare this is a mutation (readOnlyHint=false) that is neither idempotent nor destructive, and the description adds genuinely useful semantics: line numbering is 1-based and the range is inclusive. It does not say what happens on out-of-range line numbers, whether the file must exist, or what dry_run actually does, so behavioral coverage is partial rather than rich.

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, front-loaded with the primary operation and followed immediately by the non-obvious insertion trick. No filler.

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?

A lean two-sentence definition that covers the core operation and its one non-obvious edge case, appropriate for a tool whose schema and annotations already carry the signature and safety profile; return behavior is covered by the output 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 0%, so the description carries the burden and does explain start_line/end_line semantics and the insertion convention. However, dry_run (a boolean defaulting to false) is left completely unexplained, and path/new_text meanings are only implied, so the compensation is incomplete.

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?

States a specific verb+resource: replace a 1-based inclusive line range with new_text, which is precise enough to act on. It does not distinguish itself from close siblings such as edit_file, edit_file_multi, or create_file, so an agent must infer which mutation tool to pick.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The only usage guidance is an edge case (end_line=start_line-1 inserts before start_line). There is no statement of when to prefer this over edit_file/edit_file_multi, nor prerequisites such as the file needing to exist or line numbers being in range.

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