# libtmux_mcp.tools.session_tools.create_window

- **Module:** libtmux_mcp.tools.session_tools
- **Package:** libtmux-mcp
- **Language:** Python
- **Kind:** function
- **Source:** https://github.com/tmux-python/libtmux-mcp/blob/4daddc0dfca96c43bf521d818bf91564e1434760/src/libtmux_mcp/tools/session_tools.py#L113
- **Page:** https://libtmux.org/en/py/latest/mcp/reference/libtmux_mcp-tools-session_tools-create_window/

```
libtmux_mcp.tools.session_tools.create_window(session_name: str | None = None, session_id: str | None = None, window_name: str | None = None, start_directory: str | None = None, attach: bool = False, direction: t.Literal["before", "after"] | None = None, socket_name: str | None = None, environment: dict[str, str] | str | None = None, suppress_persistent_history: bool = False) -> WindowInfo
```

Create a new window in a tmux session.

Creates a window with one pane. Use split_window to add more panes afterward.

## Parameters

- `session_name` (str | None): Session name to look up.
- `session_id` (str | None): Session ID (e.g. '$1') to look up.
- `window_name` (str | None): Name for the new window.
- `start_directory` (str | None): Existing directory to start in. ``~`` expands; a relative path
resolves against the MCP server process's directory.
- `attach` (bool): Whether to make the new window active.
- `direction` (t.Literal["before", "after"] | None): Window placement direction.
- `socket_name` (str | None): tmux socket name. Defaults to LIBTMUX_SOCKET env var.
- `environment` (dict[str, str] | str | None): Per-process environment as a mapping or JSON object string. Values do
not modify the tmux session environment. Each item becomes a tmux
``-e`` launch option. Values may be visible to host process inspection
in the tmux client argv during launch and in the child environment
afterward; MCP audit redaction does not hide either surface. Pass
credential references, not literal credentials.
- `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

WindowInfo
    Serialized window object.
