tmux_resize_pane
Adjust pane dimensions in tmux sessions by specifying direction and amount to optimize terminal workspace layout.
Instructions
Resize a pane in a tmux window.
Args:
session (string, required): Name of the session
window (string or number, optional): Window index or name
pane (number, optional): Pane index
direction (string, required): Direction to resize: up, down, left, right
amount (number, optional): Number of cells to resize by (default: 5)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| session | Yes | Name of the session | |
| window | No | Window index or name | |
| pane | No | Pane index | |
| direction | Yes | Direction to resize | |
| amount | No | Number of cells to resize by |
Implementation Reference
- src/index.ts:889-905 (handler)The handler function executes the tmux resize-pane command based on the provided direction and amount, targeting the specified session, window, and pane.async ({ session, window, pane, direction, amount }) => { try { const target = formatTarget(session, window, pane); const dirFlag = { up: "-U", down: "-D", left: "-L", right: "-R" }[direction]; await runTmux(`resize-pane -t "${target}" ${dirFlag} ${amount}`); return { content: [{ type: "text", text: `Pane resized ${direction} by ${amount} cells.` }], structuredContent: { success: true, direction, amount }, }; } catch (error) { return { content: [{ type: "text", text: error instanceof Error ? error.message : String(error) }], isError: true, }; } }
- src/index.ts:873-881 (schema)Zod input schema defining parameters: session (required string), window and pane (optional), direction (enum: up/down/left/right), amount (int >=1, default 5).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).optional().describe("Pane index"), direction: z.enum(["up", "down", "left", "right"]).describe("Direction to resize"), amount: z.number().int().min(1).default(5).describe("Number of cells to resize by"), }) .strict(),
- src/index.ts:861-906 (registration)Full registration of the tmux_resize_pane tool with McpServer, including title, description, input schema, annotations, and handler function.server.registerTool( "tmux_resize_pane", { title: "Resize tmux Pane", description: `Resize a pane in a tmux window. Args: - session (string, required): Name of the session - window (string or number, optional): Window index or name - pane (number, optional): Pane index - direction (string, required): Direction to resize: up, down, left, right - amount (number, optional): Number of cells to resize by (default: 5)`, 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).optional().describe("Pane index"), direction: z.enum(["up", "down", "left", "right"]).describe("Direction to resize"), amount: z.number().int().min(1).default(5).describe("Number of cells to resize by"), }) .strict(), annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false, }, }, async ({ session, window, pane, direction, amount }) => { try { const target = formatTarget(session, window, pane); const dirFlag = { up: "-U", down: "-D", left: "-L", right: "-R" }[direction]; await runTmux(`resize-pane -t "${target}" ${dirFlag} ${amount}`); return { content: [{ type: "text", text: `Pane resized ${direction} by ${amount} cells.` }], structuredContent: { success: true, direction, amount }, }; } catch (error) { return { content: [{ type: "text", text: error instanceof Error ? error.message : String(error) }], isError: true, }; } } );