# libtmux_mcp.tools.pane_tools.swap_pane

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

```
libtmux_mcp.tools.pane_tools.swap_pane(source_pane_id: str, target_pane_id: str, socket_name: str | None = None) -> PaneInfo
```

Swap the positions of two panes.

Exchanges the visual positions of two panes. Both panes must exist.
Use this to rearrange pane layout without changing content.

## Parameters

- `source_pane_id` (str): Pane ID of the first pane (e.g. '%1').
- `target_pane_id` (str): Pane ID of the second pane (e.g. '%2').
- `socket_name` (str | None): tmux socket name.

## Returns

PaneInfo
    The source pane after swap (now in target's position).
