Skip to main content
Glama
santanusinha

neovim-use-mcp

by santanusinha

Replace a line range

nvim_edit_lines
Destructive

Replace file lines with new text using 1-based start/end line numbers. Insert before a line by setting start to end+1. Saves the buffer and returns fresh LSP diagnostics.

Instructions

This is the default way to edit files. Use the provided line numbers to directly replace lines start_line..end_line (1-based, inclusive) with new text. To insert before a line, pass start_line = end_line + 1 (for example start 5, end 4 inserts before line 5). Saves the buffer by default without running format-on-save autocmds, so the diff is minimal. Returns fresh LSP diagnostics for the file. Use nvim_format to format after editing once editing and fixes on that are done.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesFile path
saveNoWrite the buffer, default true
textYesReplacement text; use \n for several lines
end_lineYesLast line to replace, inclusive. start_line - 1 means insert
start_lineYesFirst line to replace, 1-based

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.2.1
    • changedInput schema / properties / end_line / description
      Previous value: -"Last line to replace, inclusive"New value: +"Last line to replace, inclusive. start_line - 1 means insert"
  2. First observedv0.1.0

TDQS

A4.5/5.0
Behavior5/5

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

Annotations already mark the tool as destructive and non-readOnly; the description adds valuable specifics: it saves by default, skips format-on-save autocmds, produces minimal diffs, and returns fresh LSP diagnostics. This goes well beyond what the annotations alone reveal.

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?

Four sentences deliver the core purpose, range semantics, insert behavior, save behavior, and post-edit formatting guidance with no wasted words. The most important scoping information is front-loaded.

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?

The description is complete for a mutating file-editing tool: it covers how to specify the range, how to insert, save semantics, autocmd behavior, return diagnostics, and follow-up formatting. With no output schema, the return-value note is especially useful and there are no critical 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 description coverage is 100%, so the schema already documents all five parameters. The description reinforces the 1-based inclusive range and the insert trick, but does not add substantial meaning beyond the schema, so the baseline of 3 is appropriate.

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 states a specific verb and resource: replace lines start_line..end_line with new text in a file. It also frames itself as the default way to edit files, which helps distinguish it from sibling tools like nvim_format and nvim_code_actions.

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

Usage Guidelines4/5

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

It clearly states this is the default editing method and explicitly directs the agent to use nvim_format after editing is done. It also explains the insert-before convention. It does not enumerate when to prefer other editing-related siblings, but the guidance is sufficient for a safe choice.

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