# libtmux_mcp.tools.option_tools.set_option

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

```
libtmux_mcp.tools.option_tools.set_option(option: str, value: str, scope: t.Literal["server", "session", "window", "pane"] | None = None, target: str | None = None, global_: bool = False, socket_name: str | None = None) -> OptionSetResult
```

Set a tmux option value.

Some option values are executable. tmux runs a ``#(...)`` job inside
the status formats when it draws them, and repeats it on the status
interval; ``default-command`` and ``default-shell`` decide what every
future pane runs, and ``command-alias`` rewrites later commands. The
value is stored verbatim, so an option that interprets it later runs
what is stored, not what this call did.

Use to change tmux behavior at runtime. Common uses: adjusting
history-limit, enabling mouse support, changing status bar format.

## Parameters

- `option` (str): The tmux option name to set.
- `value` (str): The value to set.
- `scope` (t.Literal["server", "session", "window", "pane"] | None): Option scope.
- `target` (str | None): Target identifier. For session scope: session name
(e.g. 'mysession'). For window scope: window ID (e.g. '@1').
For pane scope: pane ID (e.g. '%1'). Requires scope.
- `global_` (bool): Whether to set the global option.
- `socket_name` (str | None): tmux socket name.

## Returns

OptionSetResult
    Confirmation with option name, value, and status.
