tmux_rename_session
Change the name of an existing tmux session to organize terminal workspaces. Provide the current session name and the new desired name.
Instructions
Rename an existing tmux session.
Args:
old_name (string, required): Current session name
new_name (string, required): New session name
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| old_name | Yes | Current session name | |
| new_name | Yes | New session name |
Implementation Reference
- src/index.ts:803-816 (handler)The asynchronous handler function for the tmux_rename_session tool. It executes the tmux rename-session command using the runTmux helper, handles errors, and returns a structured response with success status or error message.try { await runTmux(`rename-session -t "${old_name}" "${new_name}"`); return { content: [{ type: "text", text: `Session renamed from '${old_name}' to '${new_name}'.` }], structuredContent: { success: true, old_name, new_name }, }; } catch (error) { return { content: [{ type: "text", text: error instanceof Error ? error.message : String(error) }], isError: true, }; } }
- src/index.ts:789-794 (schema)Zod input schema defining required string parameters old_name (current session name) and new_name (new session name) for the tmux_rename_session tool.inputSchema: z .object({ old_name: z.string().min(1).describe("Current session name"), new_name: z.string().min(1).describe("New session name"), }) .strict(),
- src/index.ts:780-817 (registration)Registration of the tmux_rename_session tool on the MCP server, including tool name, metadata (title, description, annotations), input schema, and inline handler function.server.registerTool( "tmux_rename_session", { title: "Rename tmux Session", description: `Rename an existing tmux session. Args: - old_name (string, required): Current session name - new_name (string, required): New session name`, inputSchema: z .object({ old_name: z.string().min(1).describe("Current session name"), new_name: z.string().min(1).describe("New session name"), }) .strict(), annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false, }, }, async ({ old_name, new_name }) => { try { await runTmux(`rename-session -t "${old_name}" "${new_name}"`); return { content: [{ type: "text", text: `Session renamed from '${old_name}' to '${new_name}'.` }], structuredContent: { success: true, old_name, new_name }, }; } catch (error) { return { content: [{ type: "text", text: error instanceof Error ? error.message : String(error) }], isError: true, }; } } );