# libtmux_mcp.tools.env_tools.set_environment

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

```
libtmux_mcp.tools.env_tools.set_environment(name: str, value: str, session_name: str | None = None, session_id: str | None = None, socket_name: str | None = None) -> EnvironmentSetResult
```

Set a tmux environment variable.

Use to set variables that will be inherited by new panes and windows.
Changes do not affect already-running processes.

Some variables control later shell execution. Bash sources the file named
by ``BASH_ENV``, POSIX shells may source the file named by ``ENV``, and
Bash evaluates ``PROMPT_COMMAND`` before displaying a prompt.

## Parameters

- `name` (str): Environment variable name.
- `value` (str): Environment variable value.
- `session_name` (str | None): Session name to set environment for.
- `session_id` (str | None): Session ID to set environment for.
- `socket_name` (str | None): tmux socket name.

## Returns

EnvironmentSetResult
    Confirmation with variable name, value, and status.
