Skip to main content
Glama
nickgnd

Tmux MCP Server

by nickgnd

create-window

Create a new named window within a tmux session to organize terminal workspaces and manage multiple command-line tasks.

Instructions

Create a new window in a tmux session

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionIdYesID of the tmux session
nameYesName for the new window

Implementation Reference

  • src/index.ts:200-228 (registration)
    Registration of the MCP 'create-window' tool, including input schema and inline handler function that calls tmux.createWindow
    server.tool(
      "create-window",
      "Create a new window in a tmux session",
      {
        sessionId: z.string().describe("ID of the tmux session"),
        name: z.string().describe("Name for the new window")
      },
      async ({ sessionId, name }) => {
        try {
          const window = await tmux.createWindow(sessionId, name);
          return {
            content: [{
              type: "text",
              text: window
                ? `Window created: ${JSON.stringify(window, null, 2)}`
                : `Failed to create window: ${name}`
            }]
          };
        } catch (error) {
          return {
            content: [{
              type: "text",
              text: `Error creating window: ${error}`
            }],
            isError: true
          };
        }
      }
    );
  • Input schema for create-window tool using Zod validation
    {
      sessionId: z.string().describe("ID of the tmux session"),
      name: z.string().describe("Name for the new window")
    },
  • MCP tool handler for create-window, which delegates to tmux.createWindow and formats response
    async ({ sessionId, name }) => {
      try {
        const window = await tmux.createWindow(sessionId, name);
        return {
          content: [{
            type: "text",
            text: window
              ? `Window created: ${JSON.stringify(window, null, 2)}`
              : `Failed to create window: ${name}`
          }]
        };
      } catch (error) {
        return {
          content: [{
            type: "text",
            text: `Error creating window: ${error}`
          }],
          isError: true
        };
      }
  • Core implementation of createWindow: executes tmux new-window command and retrieves the new window info
    export async function createWindow(sessionId: string, name: string): Promise<TmuxWindow | null> {
      const output = await executeTmux(`new-window -t '${sessionId}' -n '${name}'`);
      const windows = await listWindows(sessionId);
      return windows.find(window => window.name === name) || null;
    }
  • Helper function listWindows used by createWindow to find the newly created window
    export async function listWindows(sessionId: string): Promise<TmuxWindow[]> {
      const format = "#{window_id}:#{window_name}:#{?window_active,1,0}";
      const output = await executeTmux(`list-windows -t '${sessionId}' -F '${format}'`);
    
      if (!output) return [];
    
      return output.split('\n').map(line => {
        const [id, name, active] = line.split(':');
        return {
          id,
          name,
          active: active === '1',
          sessionId
        };
      });
    }
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. While 'Create' implies a write/mutation operation, the description doesn't disclose important behavioral traits: whether this requires specific tmux permissions, what happens if a window with the same name already exists, whether the new window becomes active, what the return value might be, or any error conditions. For a mutation tool with zero annotation coverage, this leaves significant gaps.

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 a single, efficient sentence that gets straight to the point with zero wasted words. It's appropriately sized for a simple tool and front-loads the essential information. Every word earns its place in conveying the core functionality.

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

Completeness2/5

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

For a mutation tool with no annotations and no output schema, the description is insufficiently complete. It doesn't explain what happens after creation (does it return the window ID? does it switch to the new window?), error conditions, or behavioral implications. Given the complexity of tmux window management and the lack of structured metadata, the description should provide more operational context.

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%, with both parameters (sessionId and name) well-documented in the schema. The description adds no additional parameter semantics beyond what the schema already provides - it doesn't explain format constraints, naming conventions, or provide examples. With complete schema coverage, the baseline score of 3 is appropriate.

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 window') and the resource ('in a tmux session'), providing a specific verb+resource combination. However, it doesn't differentiate from sibling tools like 'split-pane' which also creates new panes/windows, or explain how this differs from 'create-session' which creates entire sessions rather than windows within sessions.

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. It doesn't mention when to choose create-window over split-pane (which creates a new pane that could become a window), or when to use it versus create-session for session-level creation. No prerequisites, exclusions, or contextual usage information is provided.

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

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