Skip to main content
Glama

LSP code actions

nvim_lsp_code_action

List the code actions (quick fixes, refactors) the language server offers at a position, including any diagnostics there. Pass applyIndex (1-based, from a previous listing) to apply one of them.

Instructions

List the code actions (quick fixes, refactors) the language server offers at a position, including any diagnostics there. Pass applyIndex (1-based, from a previous listing) to apply one of them.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
colNo1-based column number. Default 1.
lineNo1-based line number. Default 1.
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.
applyIndexNo1-based index of the action to apply. Omit to only list.
Behavior3/5

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

With no annotations, the description must carry full behavioral disclosure. It does reveal that applyIndex applies an action and is 1-based, but it does not mention side effects of applying, error handling for invalid indices, or prerequisites like an active language server on the buffer. This is a moderate disclosure, not comprehensive.

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 sentences, front-loaded with the core action ('List the code actions'), and no redundant wording. Every clause adds useful information about list/apply behavior and index semantics.

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?

The tool has no output schema and no annotations, yet the description adequately covers the two modes (list and apply) and the main position parameter. However, it omits the shape of the returned code action list, behavior when no actions exist, and any LSP client prerequisites, leaving gaps for an agent invoking it without prior context.

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 coverage is 100% with each parameter already described. The description only restates applyIndex's purpose ('1-based, from a previous listing') already present in the schema, adding no new semantic detail beyond the structured definitions.

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 lists LSP code actions (quick fixes, refactors) at a position, and can apply one via applyIndex. This specific verb+resource pairing distinguishes it from siblings like hover, definition, references, rename, and format.

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 gives clear context: use this to list/apply code actions at a position, with diagnostics included. It does not explicitly name alternatives or exclusions, but the position-based and apply-index behavior make the intended use unambiguous among the sibling LSP tools.

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