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
| Name | Required | Description | Default |
|---|---|---|---|
| session_name | Yes | Name of the tmux session | |
| keys | Yes | Keys or command to send to the session | |
| literal | No | If true, send keys literally without appending Enter (default: false) |
Implementation Reference
- src/index.js:305-331 (handler)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}`); } }
- src/index.js:70-88 (schema)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);