Skip to main content
Glama

Read buffer

nvim_read_buffer

Read lines from a Neovim buffer using its number, file path, or current buffer. Specify a 0-based start and exclusive end, with -1 for the entire buffer.

Instructions

Read lines from a buffer (by number, path, or the current buffer). Line range is 0-based and end-exclusive; end = -1 reads to the end.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
endNoEnd line (0-based, exclusive). Default -1 (end of buffer).
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.
startNoFirst line (0-based). Default 0.
Behavior4/5

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

With no annotations provided, the description carries the burden of behavioral disclosure. It adds valuable details about line range semantics (0-based, end-exclusive, end=-1 reading to the end), which is beyond what the schema states. It does not mention return format or error handling, but covers key behavioral traits sufficiently for a simple read operation.

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?

The description is a single, front-loaded sentence that conveys the action, target options, and line range semantics without unnecessary words. Every clause earns its place, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple read tool without an output schema, the description covers the essential aspects: target buffer selection and line range behavior. It omits the return format (e.g., array of strings), but given the tool's simplicity and the clarity of the operation, it is reasonably complete. The lack of an output schema makes a return-type note beneficial, but not critical.

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 baseline is 3. The description reinforces parameter relationships (e.g., by number/path/current buffer) but does not add significant meaning beyond the schema's own property descriptions. The schema already documents defaults and exclusivity, so the description adds minimal extra value here.

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 tool reads lines from a buffer, specifying target by number, path, or current buffer. This distinguishes it from sibling tools like nvim_write_buffer (which writes) and nvim_terminal_read (which reads terminal output), making its purpose unambiguous.

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?

The description provides clear context for when to use this tool (to read buffer content) and how to specify the target (by number, path, or current buffer). However, it does not explicitly mention when not to use it or alternatives, though no direct alternatives exist among siblings for reading buffer content.

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