tmux_new_session
Create a new tmux session in detached mode. Optionally specify command, directory, size, environment variables, or reuse an existing session by name.
Instructions
Create a new session (detached by default).
Optional command runs as the first pane's command; start_directory
sets the working dir; width/height size the detached session.
attach_or_create=True makes the call idempotent: if a session named
name already exists it is reused (its id/name returned) instead of
erroring, otherwise it is created. tmux's own new-session -A attaches
the existing session, which a headless MCP server has no terminal to do;
so the reuse here is a detached has-session check (the create-time
options below only apply when the session is actually created).
env (-e KEY=VAL, tmux 3.0+) sets session environment variables before
the first command launches; ignored with a note on older tmux.
Returns the created (or existing) session's {"id", "name"}.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | ||
| start_directory | No | ||
| command | No | ||
| width | No | ||
| height | No | ||
| detached | No | ||
| attach_or_create | No | ||
| env | No | ||
| target | No |