Skip to main content
Glama

vim_register

Manage and update text content in Neovim registers. Specify a register name and content to store, enhancing workflow efficiency in the mcp-neovim-server environment.

Instructions

Manage Neovim register contents

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYesThe text content to store in the specified register
registerYesRegister name - a lowercase letter [a-z] or double-quote ["] for the unnamed register

Implementation Reference

  • Core handler function that validates the register name and uses Neovim's setreg API to store the provided content in the specified register.
    public async setRegister(register: string, content: string): Promise<string> {
      const validRegisters = [...'abcdefghijklmnopqrstuvwxyz"'];
      if (!validRegisters.includes(register)) {
        return 'Invalid register name';
      }
    
      try {
        const nvim = await this.connect();
        await nvim.eval(`setreg('${register}', '${content.replace(/'/g, "''")}')`);
        return `Register ${register} set`;
      } catch (error) {
        console.error('Error setting register:', error);
        return 'Error setting register';
      }
    }
  • src/index.ts:243-268 (registration)
    MCP server.tool registration for 'vim_register', including Zod input schema validation and thin async handler wrapper that delegates to NeovimManager.setRegister.
    server.tool(
      "vim_register",
      "Manage Neovim register contents",
      {
        register: z.string().regex(/^[a-z"]$/).describe("Register name - a lowercase letter [a-z] or double-quote [\"] for the unnamed register"),
        content: z.string().describe("The text content to store in the specified register")
      },
      async ({ register, content }) => {
        try {
          const result = await neovimManager.setRegister(register, content);
          return {
            content: [{
              type: "text",
              text: result
            }]
          };
        } catch (error) {
          return {
            content: [{
              type: "text",
              text: error instanceof Error ? error.message : 'Error setting register'
            }]
          };
        }
      }
    );
  • Zod schema defining the input parameters: register (a-z or ") and content (string).
    {
      register: z.string().regex(/^[a-z"]$/).describe("Register name - a lowercase letter [a-z] or double-quote [\"] for the unnamed register"),
      content: z.string().describe("The text content to store in the specified register")
    },
  • Helper code in getNeovimStatus that reads current register contents using getreg for status reporting.
    const registers: { [key: string]: string } = {};
    const registerNames = [...'abcdefghijklmnopqrstuvwxyz', '"', ...Array(10).keys()];
    for (const reg of registerNames) {
      try {
        const content = String(await nvim.eval(`getreg('${reg}')`));
        // Only include registers that have content
        if (content && content.trim().length > 0) {
          registers[String(reg)] = content;
        }
      } catch (e) {
        // Register empty or 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. 'Manage' is ambiguous about behavior - it doesn't specify if this is a read, write, or both operation. It doesn't disclose whether this tool modifies register contents, what happens to existing register data, or any side effects. For a tool with no annotation coverage, this leaves critical behavioral traits undefined.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise at just 4 words, which is efficient. However, this brevity comes at the cost of clarity - 'Manage' is too vague. The structure is front-loaded but under-specified rather than appropriately sized for the tool's complexity.

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 no annotations, no output schema, and a vague description, this is incomplete for a tool that presumably modifies Neovim register state. The description doesn't explain what 'manage' means operationally, what the tool returns, or how it interacts with the Neovim environment. For a tool with 2 required parameters and potential side effects, 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 fully documents both parameters (register and content). The description adds no additional meaning beyond what's in the schema - it doesn't explain register semantics in Neovim context, what happens when content is provided, or how registers are used. Baseline 3 is appropriate when schema does all the work.

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

Purpose3/5

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

The description 'Manage Neovim register contents' states the general purpose (managing register contents) but is vague about what 'manage' entails - it could mean read, write, delete, or list operations. It distinguishes from siblings like vim_buffer or vim_command by focusing on registers, but doesn't specify the exact action verb.

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?

No guidance is provided about when to use this tool versus alternatives. With siblings like vim_buffer (for buffer operations) and vim_macro (for macro recording), there's no indication of whether this tool is for storing text, retrieving register contents, or other register-related tasks. The description offers no context about appropriate use cases.

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