Skip to main content
Glama

tmux_create_session

Create a new tmux terminal session with optional name and starting directory for SSH access, command execution, and terminal automation.

Instructions

Create a new tmux session. If no name is provided, tmux will generate one. Returns session name.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
session_nameNoName for the tmux session (optional)
start_directoryNoStarting directory for the session (optional)

Implementation Reference

  • The handler function that implements the tmux_create_session tool. It constructs a tmux new-session command with optional session name and start directory, executes it asynchronously, retrieves the actual session name if not provided, and returns a success message.
    async createSession(args) {
      const { session_name, start_directory } = args;
      let cmd = "tmux new-session -d";
    
      if (session_name) {
        cmd += ` -s "${session_name}"`;
      }
    
      if (start_directory) {
        cmd += ` -c "${start_directory}"`;
      }
    
      try {
        await execAsync(cmd);
    
        // If no session name was provided, get the name of the last created session
        let actualSessionName = session_name;
        if (!session_name) {
          const { stdout } = await execAsync(
            "tmux list-sessions -F '#{session_name}' | tail -1"
          );
          actualSessionName = stdout.trim();
        }
    
        return {
          content: [
            {
              type: "text",
              text: `Created tmux session: ${actualSessionName}`,
            },
          ],
        };
      } catch (error) {
        throw new Error(`Failed to create session: ${error.message}`);
      }
    }
  • Input schema definition for the tmux_create_session tool, specifying optional string parameters for session_name and start_directory.
    inputSchema: {
      type: "object",
      properties: {
        session_name: {
          type: "string",
          description: "Name for the tmux session (optional)",
        },
        start_directory: {
          type: "string",
          description: "Starting directory for the session (optional)",
        },
      },
    },
  • src/index.js:39-56 (registration)
    Registration of the tmux_create_session tool in the ListTools response, including name, description, and input schema.
    {
      name: "tmux_create_session",
      description:
        "Create a new tmux session. If no name is provided, tmux will generate one. Returns session name.",
      inputSchema: {
        type: "object",
        properties: {
          session_name: {
            type: "string",
            description: "Name for the tmux session (optional)",
          },
          start_directory: {
            type: "string",
            description: "Starting directory for the session (optional)",
          },
        },
      },
    },
  • src/index.js:191-192 (registration)
    Registration in the CallToolRequestHandler switch statement that routes calls to the createSession handler method.
    case "tmux_create_session":
      return await this.createSession(args);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions that tmux generates a name if none is provided and returns the session name, which adds some context. However, it doesn't address important behavioral aspects like whether this requires specific permissions, if it's idempotent, what happens if a session with the same name exists, or error conditions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise with just two sentences that directly convey essential information: the core action and the return value. Every word earns its place with no wasted text.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a creation tool with no annotations and no output schema, the description provides basic but incomplete context. It covers the main action and return value but lacks important details about behavioral traits, error handling, and relationship to sibling tools. The 100% schema coverage helps but doesn't compensate for the missing behavioral transparency.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already fully documents both parameters. The description adds minimal value by mentioning the optional nature of session_name and the auto-generation behavior, but doesn't provide additional semantic context beyond what's in the schema descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Create a new tmux session') and resource ('tmux session'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like tmux_list_sessions or tmux_kill_session, which would require a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like tmux_list_sessions for checking existing sessions or tmux_kill_session for removal. It mentions the optional name parameter but offers no context about typical use cases or prerequisites.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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

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