Skip to main content
Glama

vim_tab

Command Neovim tabs directly: create, close, navigate, or list open tabs. Simplify tab management for efficient editing workflows.

Instructions

Manage Neovim tabs: create, close, and navigate between tabs

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesTab action to perform
filenameNoFilename for new tab (optional)

Implementation Reference

  • Tool handler function for vim_tab that calls neovimManager.manageTab and handles response/error formatting.
    async ({ action, filename }) => {
      try {
        const result = await neovimManager.manageTab(action, filename);
        return {
          content: [{
            type: "text",
            text: result
          }]
        };
      } catch (error) {
        return {
          content: [{
            type: "text",
            text: error instanceof Error ? error.message : 'Error managing tab'
          }]
        };
      }
    }
  • Zod input schema defining parameters for the vim_tab tool: action enum and optional filename.
    {
      action: z.enum(["new", "close", "next", "prev", "first", "last", "list"]).describe("Tab action to perform"),
      filename: z.string().optional().describe("Filename for new tab (optional)")
  • src/index.ts:510-535 (registration)
    MCP server.tool registration for 'vim_tab' including name, description, schema, and handler.
    server.tool(
      "vim_tab",
      "Manage Neovim tabs: create, close, and navigate between tabs",
      {
        action: z.enum(["new", "close", "next", "prev", "first", "last", "list"]).describe("Tab action to perform"),
        filename: z.string().optional().describe("Filename for new tab (optional)")
      },
      async ({ action, filename }) => {
        try {
          const result = await neovimManager.manageTab(action, filename);
          return {
            content: [{
              type: "text",
              text: result
            }]
          };
        } catch (error) {
          return {
            content: [{
              type: "text",
              text: error instanceof Error ? error.message : 'Error managing tab'
            }]
          };
        }
      }
    );
  • Core helper method in NeovimManager implementing all vim_tab actions using direct Neovim API commands.
    public async manageTab(action: string, filename?: string): Promise<string> {
      try {
        const nvim = await this.connect();
        
        switch (action) {
          case 'new':
            if (filename) {
              await nvim.command(`tabnew ${filename}`);
              return `Created new tab with file: ${filename}`;
            } else {
              await nvim.command('tabnew');
              return 'Created new empty tab';
            }
            
          case 'close':
            await nvim.command('tabclose');
            return 'Closed current tab';
            
          case 'next':
            await nvim.command('tabnext');
            return 'Moved to next tab';
            
          case 'prev':
            await nvim.command('tabprev');
            return 'Moved to previous tab';
            
          case 'first':
            await nvim.command('tabfirst');
            return 'Moved to first tab';
            
          case 'last':
            await nvim.command('tablast');
            return 'Moved to last tab';
            
          case 'list':
            const tabs = await nvim.tabpages;
            const tabInfo = [];
            for (let i = 0; i < tabs.length; i++) {
              const tab = tabs[i];
              const win = await tab.window;
              const buf = await win.buffer;
              const name = await buf.name;
              const current = await nvim.tabpage;
              const isCurrent = tab === current;
              tabInfo.push(`${isCurrent ? '*' : ' '}${i + 1}: ${name || '[No Name]'}`);
            }
            return `Tabs:\n${tabInfo.join('\n')}`;
            
          default:
            throw new NeovimValidationError(`Unknown tab action: ${action}`);
        }
      } catch (error) {
        if (error instanceof NeovimValidationError) {
          throw error;
        }
        console.error('Error managing tab:', error);
        throw new NeovimCommandError(`tab ${action}`, 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 the full burden of behavioral disclosure. While it mentions the actions (create, close, navigate), it doesn't describe what 'manage' entails operationally - such as whether tabs persist across sessions, if closing a tab destroys content, what permissions are needed, or what the response format looks like. For a mutation tool with zero annotation coverage, this is inadequate.

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 extremely concise - a single sentence that efficiently communicates the core functionality. It's front-loaded with the main purpose and lists the key actions. Every word earns its place with no redundant information or unnecessary elaboration.

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 this is a mutation tool (managing tabs involves creation and deletion) with no annotations and no output schema, the description is incomplete. It doesn't address what happens when tabs are created or closed, what the return values are, or how errors are handled. For a tool with 2 parameters and significant behavioral implications in a Neovim environment, more context 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%, so the schema already documents both parameters thoroughly with descriptions and enum values. The description doesn't add any meaningful parameter semantics beyond what's in the schema - it doesn't explain the relationship between 'action' and 'filename', or provide examples of how parameters interact. Baseline 3 is appropriate when 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 clearly states the tool's purpose as managing Neovim tabs with specific actions (create, close, navigate). It uses a specific verb ('manage') and identifies the resource ('Neovim tabs'). However, it doesn't explicitly distinguish this tool from its many siblings like vim_window or vim_buffer, which might have overlapping functionality in the Neovim context.

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 17 sibling tools listed, including vim_window and vim_buffer, there's no indication of how tab management differs from window or buffer operations in Neovim. The description only states what the tool does, not when it's appropriate to use it.

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