Skip to main content
Glama

Run command in a terminal

nvim_run_in_terminal

Run a shell command inside a Neovim terminal, wait for completion, and fetch its output and exit code. It shares the editor's environment and working directory.

Instructions

Open a terminal inside Neovim, run a single shell command, wait for it to finish, and return its output and exit code. This is the one-shot building block: e.g. run echo hello world and read it back. The terminal runs inside the user's editor, so the command shares the editor's environment and working directory.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cmdYesShell command to run.
cwdNoWorking directory. Defaults to Neovim's cwd.
shellNoShell to use (default: bash if available).
splitNoWhere to show the terminal. Default 'horizontal'.
keepOpenNoKeep the terminal buffer open afterwards. Default false.
timeoutMsNoMax time to wait for completion in ms. Default 15000.
Behavior4/5

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

With no annotations provided, the description carries the full burden. It discloses key behaviors: opens a terminal inside Neovim, waits for completion, returns output/exit code, and shares the editor's environment and working directory. This adds meaningful context beyond the raw parameter schema, though it could mention timeout behavior or the visual presence of the terminal.

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 two concise sentences. The first sentence front-loads the primary function and output, while the second adds an example and environmental context. No unnecessary words or repetition.

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

Completeness4/5

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

Given the six parameters and complete schema descriptions, the tool is reasonably complex, but the description covers the overall workflow and explicitly states the return values (output and exit code) despite no output schema. It could be more complete by contrasting with interactive terminal tools, but it is sufficient for correct selection and use.

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 coverage is 100% with each parameter having a description, so the baseline is 3. The description adds modest context by noting 'single shell command' and environment sharing, but does not delve into parameter-specific details, leaving the schema to do the heavy lifting.

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

Purpose5/5

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

The description clearly states the tool's function: 'run a single shell command, wait for it to finish, and return its output and exit code.' It specifies the verb (run), resource (shell command in terminal), and distinguishes itself from siblings like nvim_open_terminal or nvim_terminal_send by emphasizing the one-shot, wait-and-return behavior.

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

Usage Guidelines4/5

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

The description positions this as 'the one-shot building block' and provides an example, implying it should be used for non-interactive command execution. However, it does not explicitly name alternative tools or state when not to use it, so it lacks full explicit exclusion guidance.

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

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/Shooooooooo/nvim-mcp'

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