Skip to main content
Glama

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
NameRequiredDescriptionDefault
sessionYesName of the session
windowNoWindow index or name
paneYesPane index

Implementation Reference

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

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