Skip to main content
Glama
nickgnd
by nickgnd

create-window

Create a new named window within a specified tmux session to organize and manage terminal tasks efficiently.

Instructions

Create a new window in a tmux session

Input Schema

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

Implementation Reference

  • The async handler function for the 'create-window' MCP tool. It extracts parameters, calls the tmux.createWindow helper, formats success/error responses, and returns structured content.
    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 }; } }
  • Zod schema defining input parameters for the 'create-window' tool: sessionId (string) and name (string).
    { sessionId: z.string().describe("ID of the tmux session"), name: z.string().describe("Name for the new window") },
  • src/index.ts:200-228 (registration)
    MCP server.tool registration for 'create-window' tool, including name, description, schema, and inline handler.
    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 }; } } );
  • Core helper function implementing tmux window creation via 'tmux new-window' command, then retrieves and returns the new window object by name.
    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; }

Other Tools

Related 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