Skip to main content
Glama
laktek
by laktek

reload_buffer

Refresh a Neovim buffer from disk after external file edits to ensure the editor displays current content.

Instructions

Reload a buffer from disk. Use this after editing a file externally to refresh the buffer in Neovim.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesThe file path of the buffer to reload

Implementation Reference

  • The main handler function that finds the Neovim instance, locates the buffer by path, and executes the Neovim command to reload it from disk using 'buffer ${bufnr} | edit!'.
    export async function reloadBuffer(bufferPath) {
      const instances = await getNvimInstancesInCwd();
    
      for (const { nvim } of instances) {
        try {
          const buffers = await nvim.buffers;
    
          for (const buf of buffers) {
            const name = await buf.name;
            if (name === bufferPath) {
              // Use nvim command to reload the buffer from disk
              const bufnr = buf.id;
              await nvim.command(`buffer ${bufnr} | edit!`);
    
              return { success: true, path: bufferPath };
            }
          }
        } catch (error) {
          console.error("Error reloading buffer:", error.message);
        }
      }
    
      throw new Error(`Buffer not found: ${bufferPath}`);
    }
  • The tool schema definition including name, description, and input schema requiring a 'path' parameter.
    {
      name: "reload_buffer",
      description:
        "Reload a buffer from disk. Use this after editing a file externally to refresh the buffer in Neovim.",
      inputSchema: {
        type: "object",
        properties: {
          path: {
            type: "string",
            description: "The file path of the buffer to reload",
          },
        },
        required: ["path"],
      },
    },
  • index.js:274-284 (registration)
    The code in the CallToolRequest handler that routes calls to 'reload_buffer' to the reloadBuffer function and formats the response.
    if (name === "reload_buffer") {
      const result = await reloadBuffer(args.path);
      return {
        content: [
          {
            type: "text",
            text: `Successfully reloaded buffer: ${result.path}`,
          },
        ],
      };
    }
  • index.js:12-19 (registration)
    Import of the reloadBuffer handler function from lib/nvim-operations.js.
      getCurrentBuffer,
      listOpenBuffers,
      getBufferContent,
      updateBuffer,
      reloadBuffer,
      reloadAllBuffers,
      openFile,
    } from "./lib/nvim-operations.js";
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions the action ('reload from disk') and context ('after editing externally'), but doesn't specify whether this operation is destructive to unsaved changes, what permissions are needed, or what happens on failure. For a mutation tool with zero annotation coverage, this leaves significant behavioral questions unanswered.

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 perfectly concise with two sentences that each serve distinct purposes: the first states the core function, the second provides usage context. There's zero wasted language, and the information is front-loaded with the essential action before the contextual guidance.

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 a single-parameter tool with 100% schema coverage but no annotations and no output schema, the description provides adequate basic context about when to use the tool. However, for a mutation operation that could potentially discard unsaved buffer changes, more behavioral transparency would be beneficial. The description is complete enough for basic understanding but leaves operational risks unspecified.

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?

The schema description coverage is 100%, with the single parameter 'path' clearly documented in the schema. The description doesn't add any parameter-specific information beyond what the schema provides, such as path format examples or constraints. With complete schema coverage, the baseline score of 3 is appropriate as the description doesn't enhance parameter understanding.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Reload a buffer from disk') and resource ('buffer'), making the purpose immediately understandable. It distinguishes from siblings like 'reload_all_buffers' by specifying single-buffer operation, though not explicitly contrasting with 'update_buffer'. The description avoids tautology by explaining what reloading entails.

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 ('after editing a file externally to refresh the buffer in Neovim'), which is helpful guidance. However, it doesn't explicitly mention when NOT to use it or name alternatives like 'reload_all_buffers' for multiple buffers or 'update_buffer' for different operations. The guidance is practical but not comprehensive about alternatives.

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

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