Skip to main content
Glama

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
NameRequiredDescriptionDefault
sessionYesName of the session
windowNoWindow index or name
paneNoPane index
directionYesDirection to resize
amountNoNumber of cells to resize by

Implementation Reference

  • 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,
        };
      }
    }
  • 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,
          };
        }
      }
    );

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

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