reload_all_buffers
Reload all open buffers that have changed on disk after external file edits to maintain content synchronization in Neovim.
Instructions
Check all open buffers and reload any that have changed on disk. Use this after editing files externally.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- lib/nvim-operations.js:209-238 (handler)The core handler function that connects to Neovim instances, executes 'checktime' to reload changed buffers from disk, collects listed buffer names, and returns a success message with count.export async function reloadAllBuffers() { const instances = await getNvimInstancesInCwd(); const reloadedBuffers = []; for (const { nvim } of instances) { try { // Use checktime to reload all buffers that have changed on disk await nvim.command("checktime"); const buffers = await nvim.buffers; for (const buf of buffers) { const listed = await nvim.call("buflisted", [buf.id]); if (listed) { const name = await buf.name; if (name) { reloadedBuffers.push(name); } } } } catch (error) { console.error("Error reloading buffers:", error.message); } } return { success: true, message: `Checked ${reloadedBuffers.length} buffer(s) for changes`, buffers: reloadedBuffers, }; }
- index.js:179-187 (schema)MCP tool schema defining the tool name, description, and input schema (no required parameters). Part of the tools list returned by ListToolsRequestHandler.{ name: "reload_all_buffers", description: "Check all open buffers and reload any that have changed on disk. Use this after editing files externally.", inputSchema: { type: "object", properties: {}, }, },
- index.js:286-296 (registration)Dispatch logic in CallToolRequestHandler that matches the tool name and calls the reloadAllBuffers handler function, returning the result message.if (name === "reload_all_buffers") { const result = await reloadAllBuffers(); return { content: [ { type: "text", text: result.message, }, ], }; }
- index.js:12-19 (registration)Import of the reloadAllBuffers handler from lib/nvim-operations.js into the main server file.getCurrentBuffer, listOpenBuffers, getBufferContent, updateBuffer, reloadBuffer, reloadAllBuffers, openFile, } from "./lib/nvim-operations.js";