create-session
Create a new tmux session with a specified name to organize terminal workflows within the Tmux MCP Server environment.
Instructions
Create a new tmux session
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Name for the new tmux session |
Implementation Reference
- src/index.ts:176-196 (handler)MCP tool handler for 'create-session': calls tmux.createSession(name), handles success/error responses with formatted text output.async ({ name }) => { try { const session = await tmux.createSession(name); return { content: [{ type: "text", text: session ? `Session created: ${JSON.stringify(session, null, 2)}` : `Failed to create session: ${name}` }] }; } catch (error) { return { content: [{ type: "text", text: `Error creating session: ${error}` }], isError: true }; } }
- src/index.ts:173-175 (schema)Input schema defining 'name' parameter as required string.{ name: z.string().describe("Name for the new tmux session") },
- src/index.ts:170-172 (registration)Registration of the 'create-session' tool using server.tool() with name, description, schema, and handler.server.tool( "create-session", "Create a new tmux session",
- src/tmux.ts:162-165 (helper)Core helper function that executes the tmux 'new-session' command and retrieves the created session details.export async function createSession(name: string): Promise<TmuxSession | null> { await executeTmux(`new-session -d -s "${name}"`); return findSessionByName(name); }