Skip to main content
Glama
nickgnd
by nickgnd

create-session

Initiate a tmux session with a specified name to facilitate terminal interactions within the Tmux MCP Server environment, enabling AI assistants to manage and monitor terminal activities.

Instructions

Create a new tmux session

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesName for the new tmux session

Implementation Reference

  • MCP tool handler function for 'create-session'. Invokes tmux.createSession(name), formats success/error text response, and returns structured content.
    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 }; } }
  • Input schema definition using Zod: requires a 'name' string parameter.
    { name: z.string().describe("Name for the new tmux session") },
  • src/index.ts:170-197 (registration)
    Registration of the 'create-session' tool on the MCP server instance.
    server.tool( "create-session", "Create a new tmux session", { name: z.string().describe("Name for the new tmux session") }, 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 }; } } );
  • 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); }

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