Skip to main content
Glama

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
NameRequiredDescriptionDefault
old_nameYesCurrent session name
new_nameYesNew session name

Implementation Reference

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

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