tmux_list_panes
List all panes in a tmux session with their index, size, and active status for terminal automation and session management.
Instructions
List all panes in a tmux session with their details (index, size, active status).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| session_name | Yes | Name of the tmux session |
Implementation Reference
- src/index.js:429-461 (handler)Handler function that executes the tmux_list_panes tool by running 'tmux list-panes' command, parsing output into JSON array of pane details.async listPanes(args) { const { session_name } = args; try { const { stdout } = await execAsync( `tmux list-panes -t "${session_name}" -F '#{pane_index}|#{pane_width}x#{pane_height}|#{pane_active}|#{pane_current_command}'` ); const panes = stdout .trim() .split("\n") .map((line) => { const [index, size, active, command] = line.split("|"); return { index: parseInt(index), size, active: active === "1", command, }; }); return { content: [ { type: "text", text: JSON.stringify(panes, null, 2), }, ], }; } catch (error) { throw new Error(`Failed to list panes: ${error.message}`); } }
- src/index.js:168-182 (schema)Tool schema definition including name, description, and input schema requiring 'session_name'.{ name: "tmux_list_panes", description: "List all panes in a tmux session with their details (index, size, active status).", inputSchema: { type: "object", properties: { session_name: { type: "string", description: "Name of the tmux session", }, }, required: ["session_name"], }, },
- src/index.js:205-205 (registration)Registration in the switch statement dispatching calls to the listPanes handler.case "tmux_list_panes":
- src/index.js:37-184 (registration)Tool is registered in the ListToolsRequestHandler by including it in the tools array.this.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [ { name: "tmux_create_session", description: "Create a new tmux session. If no name is provided, tmux will generate one. Returns session name.", inputSchema: { type: "object", properties: { session_name: { type: "string", description: "Name for the tmux session (optional)", }, start_directory: { type: "string", description: "Starting directory for the session (optional)", }, }, }, }, { name: "tmux_list_sessions", description: "List all active tmux sessions with their details (name, windows, created time, attached status).", inputSchema: { type: "object", properties: {}, }, }, { 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"], }, }, { name: "tmux_capture_pane", description: "Capture the visible content of a tmux pane. Returns the text currently displayed in the pane.", inputSchema: { type: "object", properties: { session_name: { type: "string", description: "Name of the tmux session", }, pane_index: { type: "string", description: "Pane index (default: 0 for main pane)", }, lines: { type: "number", description: "Number of lines to capture from scrollback (default: captures visible area, use -1 for entire scrollback)", }, }, required: ["session_name"], }, }, { name: "tmux_kill_session", description: "Kill/terminate a tmux session and all its windows and panes.", inputSchema: { type: "object", properties: { session_name: { type: "string", description: "Name of the tmux session to kill", }, }, required: ["session_name"], }, }, { name: "tmux_split_window", description: "Split the current window in a tmux session horizontally or vertically to create a new pane.", inputSchema: { type: "object", properties: { session_name: { type: "string", description: "Name of the tmux session", }, vertical: { type: "boolean", description: "If true, split vertically (side by side). If false, split horizontally (top and bottom). Default: false", }, }, required: ["session_name"], }, }, { name: "tmux_select_pane", description: "Select a specific pane in a tmux session to make it active for commands.", inputSchema: { type: "object", properties: { session_name: { type: "string", description: "Name of the tmux session", }, pane_index: { type: "string", description: "Pane index to select (e.g., '0', '1', '2')", }, }, required: ["session_name", "pane_index"], }, }, { name: "tmux_list_panes", description: "List all panes in a tmux session with their details (index, size, active status).", inputSchema: { type: "object", properties: { session_name: { type: "string", description: "Name of the tmux session", }, }, required: ["session_name"], }, }, ], }));