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');
      }
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions opening files into 'new buffers,' which implies creation behavior, but lacks details on permissions, error handling (e.g., if file doesn't exist), side effects (e.g., buffer numbering), or response format. For a tool with no annotation coverage, this leaves significant behavioral gaps.

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 a single, efficient sentence: 'Open files into new buffers.' It is front-loaded with the core action and target, with zero wasted words. Every part of the sentence contributes directly to understanding the tool's function.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (file operations in Vim), no annotations, no output schema, and 100% schema coverage for a single parameter, the description is incomplete. It lacks context on error cases, Vim-specific behaviors (e.g., buffer management), and integration with sibling tools. For a tool in a rich Vim environment, more guidance is needed.

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 description coverage is 100%, with the single parameter 'filename' documented as 'Path to the file to open.' The description adds no additional parameter semantics beyond what the schema provides, such as path format examples or constraints. With high schema coverage, the baseline score of 3 is appropriate as the schema does the heavy lifting.

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 'Open files into new buffers' clearly states the action (open) and target (files into new buffers). It distinguishes from siblings like vim_buffer_switch (switching existing buffers) and vim_edit (editing without specifying buffer creation), but doesn't explicitly contrast with all siblings like vim_command or vim_search. The purpose is specific and actionable.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. With siblings like vim_edit (which might open files differently), vim_buffer (managing buffers), and vim_command (executing Vim commands), there's no indication of preferred contexts, prerequisites, or exclusions. Usage is implied only by the tool name and basic action.

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

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