Skip to main content
Glama

add_virtual_text

Overlay virtual text annotations on a Neovim buffer's lines. Choose position (eol, above, below) and color for visual-only feedback.

Instructions

Add a virtual text annotation to a Neovim buffer. Visual only — the buffer's actual content is unchanged and nothing is written to disk. Annotations stack; multiple calls accumulate.

file: path relative to Neovim's cwd (as shown in get_state buffers). The buffer must already be open in Neovim; returns an error otherwise. line: 1-indexed anchor line. Out-of-range values are clamped. text: list of strings, one per virtual line. Must be non-empty. When position is "eol", exactly one item is allowed. position: where the annotation appears relative to the anchor line. One of "eol" (after end of line), "above" (between previous and anchor lines), or "below" (between anchor and next lines). Defaults to "eol". color: a Neovim highlight group name (e.g. "Comment", "DiagnosticError") or a hex color (e.g. "#7a9ad4"). Defaults to "Comment", which adapts to the user's colorscheme. Unknown names (including bare color literals like "Red") return an error.

Use this for a single annotation. Use add_virtual_texts for multiple annotations in one call. Use clear_virtual_texts to remove all MCP virtual text from a buffer.

Returns {added: 1} on success, or {error} with a message on failure.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fileYes
lineYes
textYes
positionNoeol
colorNoComment
Behavior5/5

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

With no annotations provided, the description fully discloses behavioral traits: annotations stack, buffer must be open, line clamping, text constraints per position, and error conditions for unknown colors and missing buffer.

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 well-structured and concise: purpose upfront, visual-only note, parameter details, sibling references, and return value. Every sentence adds value with no redundancy.

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?

Given no output schema and no annotations, the description covers all aspects: parameter behavior, error handling, stacking, and return format. It is sufficiently complete for an agent to use the tool correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Despite 0% schema coverage, the description explains each parameter in detail: file path relative to cwd, line indexing and clamping, text array constraints, position options with default, and color type with default and error handling. This adds significant meaning beyond 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 tool adds a virtual text annotation to a Neovim buffer, emphasizing it is visual-only and does not alter the buffer's content. It explicitly distinguishes from siblings like add_virtual_texts and clear_virtual_texts.

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

Usage Guidelines5/5

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

The description provides explicit guidance on when to use this tool vs alternatives: 'Use this for a single annotation. Use add_virtual_texts for multiple annotations in one call. Use clear_virtual_texts to remove all MCP virtual text from a buffer.'

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/paulburgess1357/nvim-mcp'

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