Prerelease This site documents an alpha of libtmux. Its structure, URLs and APIs are subject to change.

libtmux_mcp.tools.server_tools.create_session

Python
  • Python
  • Ruby Unavailable
  • Lua Unavailable
  • TypeScript Unavailable
  • Rust Unavailable
  • Go Unavailable
  • Java Unavailable
  • .NET Unavailable
  • C++ Unavailable
  • Swift Unavailable

API reference · Markdown

libtmux_mcp.tools.server_tools.create_session ( session_name : str | None = None , window_name : str | None = None , start_directory : str | None = None , x : int | None = None , y : int | None = None , environment : dict[str, str] | str | None = None , socket_name : str | None = None , suppress_persistent_history : bool = False ) → SessionInfo
function [source]
function [source]
libtmux_mcp.tools.server_tools.create_session

Create a new tmux session.

Check list_sessions first to avoid name conflicts. A new session starts with one window and one pane. Values in environment are stored in the tmux session environment, so future panes inherit them too.

Parameters
  • session_name ( str | None ) – Name for the new session.

  • window_name ( str | None ) – Name for the initial window.

  • start_directory ( str | None ) – Existing directory to start in. ~ expands; a relative path resolves against the MCP server process's directory.

  • x ( int | None ) – Width of the initial window.

  • y ( int | None ) – Height of the initial window.

  • environment ( dict[str, str] | str | None ) – Environment variables to store in the session environment. Accepts either a dict of env vars or a JSON-serialized string of the same — the latter is the cursor-composer-1 workaround described in libtmux_mcp._utils._coerce_dict_arg. Each item appears in the tmux client argv as one -eKEY=VALUE element and may be visible to host process inspection during launch. tmux retains the values in tmux session state, where show-environment can reveal them. They reach the initial and future child environments unless a later spawn overrides them. MCP audit redaction does not hide these surfaces. Pass credential references, not literal credentials.

  • socket_name ( str | None ) – tmux socket name. Defaults to LIBTMUX_SOCKET env var.

  • suppress_persistent_history ( bool ) – Whether to suppress persistent history for the spawned shell. Defaults to False for MCP and direct Python calls. This per-call option does not inherit LIBTMUX_SUPPRESS_HISTORY. Startup files may override these controls.

Returns

SessionInfo The created session.

Esc

Type to search.