Skip to main content
Glama

Write buffer lines

nvim_write_buffer

Replace a line range in an open Neovim buffer with new lines. Use zero-based start and end indices; set start=0 and end=-1 to overwrite the entire buffer.

Instructions

Replace a line range in a buffer with new lines. Line range is 0-based and end-exclusive; use start = 0, end = -1 to replace the whole buffer.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
endNoEnd line (0-based, exclusive). Default -1 (replace to end).
pathNoTarget buffer by file path (must already be open). Ignored if bufnr is set.
bufnrNoTarget buffer number. Omit to use the path or the current buffer.
linesYesReplacement lines (no trailing newlines).
startNoFirst line to replace (0-based). Default 0.
Behavior3/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 explains the core behavior of replacing line ranges but does not disclose side effects (e.g., undo behavior, buffer freshness, or error conditions like buffer-only-open). The description is adequate for simple write operations but lacks depth.

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?

One dense sentence that front-loads the purpose and includes critical range details. No unnecessary filler.

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?

Given the tool has 5 parameters with full schema coverage and no output schema, the description is sufficient for the primary use case. However, it does not explain return values or error behavior, which might be expected for a write operation.

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 covers 100% of parameters with individual descriptions, so baseline is 3. The description adds value by explaining the whole-buffer replacement pattern, but most semantics are already present in the schema.

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 clearly states the action ('Replace a line range in a buffer with new lines') with a specific resource ('buffer') and the line range semantics. It distinguishes from sibling tools like nvim_read_buffer (read) and terminal tools.

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?

Provides concrete guidance on line range semantics including the 0-based, end-exclusive convention and the special case for replacing the whole buffer (start=0, end=-1). Does not explicitly mention alternatives or when-not-to-use, but the context is clear and actionable.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Shooooooooo/nvim-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server