# swap_pane

Source: https://libtmux.org/en/py/latest/mcp/tools/swap_pane/

> Swap the positions of two panes.

MCP is in development

Server behavior and tool contracts may change. Tool availability depends on the server configuration.

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.

[All Python tools](https://libtmux.org/en/py/latest/mcp/tools/) · [JSON](https://libtmux.org/en/py/latest/mcp/tools/swap_pane.json) · [Source](https://github.com/tmux-python/libtmux-mcp/blob/4daddc0dfca96c43bf521d818bf91564e1434760/src/libtmux_mcp/tools/pane_tools/__init__.py#L169)

## Arguments

* `socket_name` optional

  tmux socket name.

  Default: `null`.

* `source_pane_id` required · string

  Pane ID of the first pane (e.g. '%1').

* `target_pane_id` required · string

  Pane ID of the second pane (e.g. '%2').

## Schemas

The schema defines required fields, nested values, defaults, and validation constraints.

Input schema

```json
{
  "additionalProperties": false,
  "properties": {
    "socket_name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "tmux socket name."
    },
    "source_pane_id": {
      "description": "Pane ID of the first pane (e.g. '%1').",
      "type": "string"
    },
    "target_pane_id": {
      "description": "Pane ID of the second pane (e.g. '%2').",
      "type": "string"
    }
  },
  "required": [
    "source_pane_id",
    "target_pane_id"
  ],
  "type": "object"
}
```

Output schema

```json
{
  "description": "Serialized tmux pane.",
  "properties": {
    "is_caller": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "MCP caller identity for this pane. ``True`` when the pane matches the caller's ``TMUX_PANE`` *and* lives on the same tmux socket as the caller's ``TMUX`` (verified via socket realpath); ``False`` otherwise, including the case where the pane id matches but the socket does not or cannot be proven to; ``None`` when the MCP process is not running inside tmux at all."
    },
    "pane_active": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Active flag ('1' or '0')"
    },
    "pane_at_bottom": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "True when the pane touches the window's bottom edge."
    },
    "pane_at_left": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "True when the pane touches the window's left edge."
    },
    "pane_at_right": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "True when the pane touches the window's right edge."
    },
    "pane_at_top": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "True when the pane touches the window's top edge. tmux accounts for ``pane-border-status`` here, so the top row may be 1 instead of 0 when the status bar is at the top."
    },
    "pane_bottom": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Bottom edge row (inclusive), window-relative."
    },
    "pane_current_command": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Running command"
    },
    "pane_current_path": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Current working directory"
    },
    "pane_height": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Height in rows"
    },
    "pane_id": {
      "description": "Pane ID (e.g. '%1')",
      "type": "string"
    },
    "pane_index": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Pane index"
    },
    "pane_left": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Left edge column, 0-based and window-relative."
    },
    "pane_pid": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Process ID"
    },
    "pane_right": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Right edge column (inclusive), window-relative."
    },
    "pane_title": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Pane title"
    },
    "pane_top": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Top edge row, 0-based and window-relative."
    },
    "pane_tty": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "TTY device path of the pane (e.g. '/dev/pts/5')."
    },
    "pane_width": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Width in columns"
    },
    "session_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Parent session ID"
    },
    "window_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Parent window ID"
    }
  },
  "required": [
    "pane_id"
  ],
  "type": "object"
}
```

Tool annotations

```json
{
  "destructiveHint": true,
  "idempotentHint": false,
  "openWorldHint": true,
  "readOnlyHint": false
}
```
