# libtmux.neo.get_output_format

- **Module:** libtmux.neo
- **Package:** libtmux
- **Language:** Python
- **Kind:** function
- **Source:** https://github.com/tmux-python/libtmux/blob/036c521c4b83ce6e434eb50afe2a0d08a6a05e46/src/libtmux/neo.py#L909
- **Page:** https://libtmux.org/reference/py/libtmux-neo-get_output_format/

```
libtmux.neo.get_output_format(list_cmd: str = "list-panes", tmux_version: str = "3.2a") -> tuple[tuple[str, ...], str]
```

Return field names and tmux format string filtered by scope and version.

Only emits tokens whose scope is reachable from *list_cmd* (per
:data:`SCOPES_BY_LIST_CMD`) and whose minimum tmux version (per
:data:`FIELD_VERSION`) is at or below *tmux_version*. Runtime-only
tokens (``mouse_*``, ``cursor_*``, popups) are excluded from every
``list-*`` template — they only resolve in event-time format contexts.

## Parameters

- `list_cmd` (str) — The tmux list subcommand the format string is being built for.
Determines which token scopes are reachable.
- `tmux_version` (str) — The live tmux version. Used to gate post-3.2a tokens. Defaults to
``"3.2a"`` (the project's minimum) for safe fallback when the
caller can't yet detect the version.

## Returns

tuple[tuple[str, ...], str]
    A tuple of (field_names, tmux_format_string) restricted to tokens
    the given *list_cmd* and *tmux_version* can resolve.

## Example

```python
>>> from libtmux.neo import get_output_format
>>> fields, fmt = get_output_format("list-sessions", "3.6a")
>>> 'session_id' in fields
True
>>> 'pane_id' in fields  # active pane for the listed session
True
>>> 'client_name' in fields  # upward not allowed
False
>>> 'server' in fields
False
```

## Example

Pane scope picks up window and session tokens too:

```python
>>> fields, _ = get_output_format("list-panes", "3.6a")
>>> all(t in fields for t in ('pane_id', 'window_id', 'session_id'))
True
```

## Example

``list-clients`` adds fields for the attached client:

```python
>>> fields, _ = get_output_format("list-clients", "3.6a")
>>> 'client_name' in fields
True
>>> 'pane_id' in fields
True
```
