tmux_rename_window
Change the name of a tmux window to organize terminal sessions by specifying the session, window, and new name.
Instructions
Rename a window in a tmux session.
Args:
session (string, required): Name of the session
window (string or number, required): Window index or current name
new_name (string, required): New window name
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| session | Yes | Name of the session | |
| window | Yes | Window index or current name | |
| new_name | Yes | New window name |
Implementation Reference
- src/index.ts:843-858 (handler)The handler function that executes the tmux_rename_window tool logic, formatting the session:window target and running the 'tmux rename-window' command.async ({ session, window, new_name }) => { try { const target = formatTarget(session, window); await runTmux(`rename-window -t "${target}" "${new_name}"`); return { content: [{ type: "text", text: `Window '${window}' renamed to '${new_name}'.` }], structuredContent: { success: true, session, window, new_name }, }; } catch (error) { return { content: [{ type: "text", text: error instanceof Error ? error.message : String(error) }], isError: true, }; } }
- src/index.ts:829-835 (schema)Zod input schema defining parameters for the tmux_rename_window tool: session (string), window (string|number), new_name (string).inputSchema: z .object({ session: z.string().min(1).describe("Name of the session"), window: z.union([z.string(), z.number()]).describe("Window index or current name"), new_name: z.string().min(1).describe("New window name"), }) .strict(),
- src/index.ts:819-859 (registration)Registration of the tmux_rename_window tool using server.registerTool, including title, description, input schema, annotations, and handler function.server.registerTool( "tmux_rename_window", { title: "Rename tmux Window", description: `Rename a window in a tmux session. Args: - session (string, required): Name of the session - window (string or number, required): Window index or current name - new_name (string, required): New window name`, inputSchema: z .object({ session: z.string().min(1).describe("Name of the session"), window: z.union([z.string(), z.number()]).describe("Window index or current name"), new_name: z.string().min(1).describe("New window name"), }) .strict(), annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false, }, }, async ({ session, window, new_name }) => { try { const target = formatTarget(session, window); await runTmux(`rename-window -t "${target}" "${new_name}"`); return { content: [{ type: "text", text: `Window '${window}' renamed to '${new_name}'.` }], structuredContent: { success: true, session, window, new_name }, }; } catch (error) { return { content: [{ type: "text", text: error instanceof Error ? error.message : String(error) }], isError: true, }; } } );
- src/index.ts:70-81 (helper)Helper function formatTarget used by the handler to construct the tmux target string from session, window, and optional pane.function formatTarget(session?: string, window?: number | string, pane?: number): string { let target = ""; if (session) { target = session; if (window !== undefined) { target += `:${window}`; if (pane !== undefined) { target += `.${pane}`; } } } return target;