tmux_select_pane
Switch to a specific pane in a tmux window by specifying session, window, and pane indices for efficient terminal navigation.
Instructions
Switch to a specific pane in a tmux window.
Args:
session (string, required): Name of the session
window (string or number, optional): Window index or name
pane (number, required): Pane index
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| session | Yes | Name of the session | |
| window | No | Window index or name | |
| pane | Yes | Pane index |
Implementation Reference
- src/index.ts:762-777 (handler)The main handler function for the tmux_select_pane tool. It formats the tmux target using formatTarget helper and executes the tmux select-pane command via runTmux.async ({ session, window, pane }) => { try { const target = formatTarget(session, window, pane); await runTmux(`select-pane -t "${target}"`); return { content: [{ type: "text", text: `Switched to pane ${pane}.` }], structuredContent: { success: true, session, window, pane }, }; } catch (error) { return { content: [{ type: "text", text: error instanceof Error ? error.message : String(error) }], isError: true, }; } }
- src/index.ts:748-754 (schema)Zod input schema defining the parameters for the tmux_select_pane tool: session (required string), window (optional string/number), pane (required non-negative integer).inputSchema: z .object({ session: z.string().min(1).describe("Name of the session"), window: z.union([z.string(), z.number()]).optional().describe("Window index or name"), pane: z.number().int().min(0).describe("Pane index"), }) .strict(),
- src/index.ts:738-779 (registration)Registration of the tmux_select_pane tool using server.registerTool, including the tool name, metadata (title, description, inputSchema, annotations), and the handler function.server.registerTool( "tmux_select_pane", { title: "Select tmux Pane", description: `Switch to a specific pane in a tmux window. Args: - session (string, required): Name of the session - window (string or number, optional): Window index or name - pane (number, required): Pane index`, inputSchema: z .object({ session: z.string().min(1).describe("Name of the session"), window: z.union([z.string(), z.number()]).optional().describe("Window index or name"), pane: z.number().int().min(0).describe("Pane index"), }) .strict(), annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false, }, }, async ({ session, window, pane }) => { try { const target = formatTarget(session, window, pane); await runTmux(`select-pane -t "${target}"`); return { content: [{ type: "text", text: `Switched to pane ${pane}.` }], structuredContent: { success: true, session, window, pane }, }; } catch (error) { return { content: [{ type: "text", text: error instanceof Error ? error.message : String(error) }], isError: true, }; } } );