Skip to main content
Glama

vim_file_open

Open files directly into new buffers within Neovim using a specific filename path, streamlining file access during code editing.

Instructions

Open files into new buffers

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filenameYesPath to the file to open

Implementation Reference

  • The inline handler function for the vim_file_open tool. It calls neovimManager.openFile(filename), formats the response as MCP content, and handles errors.
    async ({ filename }) => { try { const result = await neovimManager.openFile(filename); return { content: [{ type: "text", text: result }] }; } catch (error) { return { content: [{ type: "text", text: error instanceof Error ? error.message : 'Error opening file' }] }; } }
  • Zod input schema defining the 'filename' parameter for the vim_file_open tool.
    { filename: z.string().describe("Path to the file to open") },
  • src/index.ts:352-376 (registration)
    MCP server.tool call that registers the vim_file_open tool with its description, schema, and handler function.
    server.tool( "vim_file_open", "Open files into new buffers", { filename: z.string().describe("Path to the file to open") }, async ({ filename }) => { try { const result = await neovimManager.openFile(filename); return { content: [{ type: "text", text: result }] }; } catch (error) { return { content: [{ type: "text", text: error instanceof Error ? error.message : 'Error opening file' }] }; } } );
  • NeovimManager.openFile method: the core logic that connects to Neovim and executes the 'edit filename' command to open the file into a new buffer.
    public async openFile(filename: string): Promise<string> { if (!filename || filename.trim().length === 0) { throw new NeovimValidationError('Filename cannot be empty'); } try { const nvim = await this.connect(); await nvim.command(`edit ${filename}`); return `Opened file: ${filename}`; } catch (error) { console.error('Error opening file:', error); throw new NeovimCommandError(`edit ${filename}`, error instanceof Error ? error.message : 'Unknown error'); } }

Other Tools

Related 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/bigcodegen/mcp-neovim-server'

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