Skip to main content
Glama

tmux_send_keys

Send keyboard input or commands to tmux terminal sessions for automation, with optional Enter key simulation for command execution.

Instructions

Send keys/commands to a tmux session. Automatically appends Enter unless literal mode is specified.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
session_nameYesName of the tmux session
keysYesKeys or command to send to the session
literalNoIf true, send keys literally without appending Enter (default: false)

Implementation Reference

  • The main handler function for the 'tmux_send_keys' tool. It destructures the arguments, builds a tmux send-keys command (escaping quotes in keys), optionally appends 'Enter' if literal is false, executes it via execAsync, and returns a success message or throws an error.
    async sendKeys(args) {
      const { session_name, keys, literal = false } = args;
    
      try {
        let cmd = `tmux send-keys -t "${session_name}" "${keys.replace(
          /"/g,
          '\\"'
        )}"`;
    
        if (!literal) {
          cmd += " Enter";
        }
    
        await execAsync(cmd);
    
        return {
          content: [
            {
              type: "text",
              text: `Sent keys to session ${session_name}`,
            },
          ],
        };
      } catch (error) {
        throw new Error(`Failed to send keys: ${error.message}`);
      }
    }
  • The input schema for the tmux_send_keys tool, defining required session_name and keys strings, and optional literal boolean.
    inputSchema: {
      type: "object",
      properties: {
        session_name: {
          type: "string",
          description: "Name of the tmux session",
        },
        keys: {
          type: "string",
          description: "Keys or command to send to the session",
        },
        literal: {
          type: "boolean",
          description:
            "If true, send keys literally without appending Enter (default: false)",
        },
      },
      required: ["session_name", "keys"],
    },
  • src/index.js:66-89 (registration)
    Registration of the tmux_send_keys tool in the ListTools response, including name, description, and input schema.
    {
      name: "tmux_send_keys",
      description:
        "Send keys/commands to a tmux session. Automatically appends Enter unless literal mode is specified.",
      inputSchema: {
        type: "object",
        properties: {
          session_name: {
            type: "string",
            description: "Name of the tmux session",
          },
          keys: {
            type: "string",
            description: "Keys or command to send to the session",
          },
          literal: {
            type: "boolean",
            description:
              "If true, send keys literally without appending Enter (default: false)",
          },
        },
        required: ["session_name", "keys"],
      },
    },
  • src/index.js:195-196 (registration)
    Registration/dispatch of the tmux_send_keys tool in the CallToolRequestHandler switch statement, calling the sendKeys method.
    case "tmux_send_keys":
      return await this.sendKeys(args);
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 of behavioral disclosure. It successfully reveals a critical behavioral trait: 'Automatically appends Enter unless literal mode is specified.' This explains the default behavior and how to override it, which is essential for correct tool invocation.

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 perfectly concise with two sentences that each earn their place. The first sentence states the core purpose, and the second sentence adds crucial behavioral information. There's zero wasted language and it's effectively front-loaded.

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?

For a tool with 3 parameters, 100% schema coverage, and no output schema, the description provides good contextual completeness. It explains the key behavioral aspect (Enter appending) that isn't captured in the schema. However, it doesn't mention potential side effects or error conditions that might be relevant for a command-sending tool.

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?

The schema description coverage is 100%, so all parameters are documented in the schema. The description doesn't add any parameter-specific details beyond what's already in the schema descriptions. It mentions 'literal mode' which corresponds to the 'literal' parameter, but this is already covered in the schema.

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 specific action ('Send keys/commands') and target resource ('to a tmux session'), distinguishing it from siblings like tmux_list_sessions or tmux_kill_session. It precisely identifies the tool's function without being vague or tautological.

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 provides clear context about when to use it (for sending input to tmux sessions) and includes a key behavioral detail (appends Enter by default) that informs usage. However, it doesn't explicitly state when NOT to use it or name specific alternatives among the sibling tools.

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/MediocreTriumph/tmux-mcp'

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