# list_sessions

Source: https://libtmux.org/en/py/stable/mcp/tools/list_sessions/

> List tmux sessions (terminal workspaces) on a tmux server.

tool MCPstable

MCP is in development

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

* **list_sessions**( [filters](https://libtmux.org/en/py/stable/mcp/tools/list_sessions/#mcp.tool.list_sessions.input%2Fproperties%2Ffilters)?: [Record](https://json-schema.org/understanding-json-schema/reference/object "object (JSON Schema)")\<string, [string](https://json-schema.org/understanding-json-schema/reference/string "string (JSON Schema)")> | [string](https://json-schema.org/understanding-json-schema/reference/string "string (JSON Schema)") | [null](https://json-schema.org/understanding-json-schema/reference/null "null (JSON Schema)"), [socket_name](https://libtmux.org/en/py/stable/mcp/tools/list_sessions/#mcp.tool.list_sessions.input%2Fproperties%2Fsocket_name)?: [string](https://json-schema.org/understanding-json-schema/reference/string "string (JSON Schema)") | [null](https://json-schema.org/understanding-json-schema/reference/null "null (JSON Schema)"), )

  tool \[[source](https://github.com/tmux-python/libtmux-mcp/blob/4daddc0dfca96c43bf521d818bf91564e1434760/src/libtmux_mcp/tools/server_tools.py#L362)][¶](https://libtmux.org/en/py/stable/mcp/tools/list_sessions/#mcp.tool.list_sessions)

  List tmux sessions (terminal workspaces) on a tmux server.

  Use for tmux multiplexer sessions — ‘this session’, ‘my workspace’, ‘the dev session’ — not login sessions or HTTP sessions. The starting point for discovery — call this before targeting specific sessions, windows, or panes.

  * MCP request method

    `tools/call` Send `list_sessions` as the tool name, with the arguments below.

  ## Arguments[#](https://libtmux.org/en/py/stable/mcp/tools/list_sessions/#mcp.tool.list_sessions.parameters)

  * **[`filters`](https://libtmux.org/en/py/stable/mcp/tools/list_sessions/#mcp.tool.list_sessions.input%2Fproperties%2Ffilters)**? = `null` ([Record](https://json-schema.org/understanding-json-schema/reference/object "object (JSON Schema)")\<string, [string](https://json-schema.org/understanding-json-schema/reference/string "string (JSON Schema)")> | [string](https://json-schema.org/understanding-json-schema/reference/string "string (JSON Schema)") | [null](https://json-schema.org/understanding-json-schema/reference/null "null (JSON Schema)"))

    Django-style filters as a dict (e.g. `{"session_name__contains": "dev"}`) or as a JSON string. Some MCP clients require the string form.

  * **[`socket_name`](https://libtmux.org/en/py/stable/mcp/tools/list_sessions/#mcp.tool.list_sessions.input%2Fproperties%2Fsocket_name)**? = `null` ([string](https://json-schema.org/understanding-json-schema/reference/string "string (JSON Schema)") | [null](https://json-schema.org/understanding-json-schema/reference/null "null (JSON Schema)"))

    tmux socket name. Defaults to LIBTMUX_SOCKET env var.

  No other arguments are accepted.

  ## Result[#](https://libtmux.org/en/py/stable/mcp/tools/list_sessions/#mcp.tool.list_sessions.result)

  Returns [object](https://json-schema.org/understanding-json-schema/reference/object "object (JSON Schema)")

  * **[`result`](https://libtmux.org/en/py/stable/mcp/tools/list_sessions/#mcp.tool.list_sessions.output%2Fproperties%2Fresult)** ([Array](https://json-schema.org/understanding-json-schema/reference/array "array (JSON Schema)")<[object](https://json-schema.org/understanding-json-schema/reference/object "object (JSON Schema)")>)

    * **[Items](https://libtmux.org/en/py/stable/mcp/tools/list_sessions/#mcp.tool.list_sessions.output%2Fproperties%2Fresult%2Fitems)** ([object](https://json-schema.org/understanding-json-schema/reference/object "object (JSON Schema)"))

      Serialized tmux session.

      * **[`active_pane_id`](https://libtmux.org/en/py/stable/mcp/tools/list_sessions/#mcp.tool.list_sessions.output%2Fproperties%2Fresult%2Fitems%2Fproperties%2Factive_pane_id)**? = `null` ([string](https://json-schema.org/understanding-json-schema/reference/string "string (JSON Schema)") | [null](https://json-schema.org/understanding-json-schema/reference/null "null (JSON Schema)"))

        Pane id (`%N`) of the session’s active pane. Guaranteed non-None on [`create_session`](https://libtmux.org/en/py/stable/mcp/tools/create_session/) return (libtmux creates the session with one initial pane). May be None from `list_sessions` rows for sessions in transient teardown states where `active_pane` is unavailable.

      * **[`session_attached`](https://libtmux.org/en/py/stable/mcp/tools/list_sessions/#mcp.tool.list_sessions.output%2Fproperties%2Fresult%2Fitems%2Fproperties%2Fsession_attached)**? = `null` ([string](https://json-schema.org/understanding-json-schema/reference/string "string (JSON Schema)") | [null](https://json-schema.org/understanding-json-schema/reference/null "null (JSON Schema)"))

        Attached client count

      * **[`session_created`](https://libtmux.org/en/py/stable/mcp/tools/list_sessions/#mcp.tool.list_sessions.output%2Fproperties%2Fresult%2Fitems%2Fproperties%2Fsession_created)**? = `null` ([string](https://json-schema.org/understanding-json-schema/reference/string "string (JSON Schema)") | [null](https://json-schema.org/understanding-json-schema/reference/null "null (JSON Schema)"))

        Creation timestamp

      * **[`session_id`](https://libtmux.org/en/py/stable/mcp/tools/list_sessions/#mcp.tool.list_sessions.output%2Fproperties%2Fresult%2Fitems%2Fproperties%2Fsession_id)** ([string](https://json-schema.org/understanding-json-schema/reference/string "string (JSON Schema)"))

        Session ID (e.g. ‘$1’)

      * **[`session_name`](https://libtmux.org/en/py/stable/mcp/tools/list_sessions/#mcp.tool.list_sessions.output%2Fproperties%2Fresult%2Fitems%2Fproperties%2Fsession_name)**? = `null` ([string](https://json-schema.org/understanding-json-schema/reference/string "string (JSON Schema)") | [null](https://json-schema.org/understanding-json-schema/reference/null "null (JSON Schema)"))

        Session name

      * **[`window_count`](https://libtmux.org/en/py/stable/mcp/tools/list_sessions/#mcp.tool.list_sessions.output%2Fproperties%2Fresult%2Fitems%2Fproperties%2Fwindow_count)** ([integer](https://json-schema.org/understanding-json-schema/reference/numeric "numeric (JSON Schema)"))

        Number of windows

  ## Annotations[#](https://libtmux.org/en/py/stable/mcp/tools/list_sessions/#mcp.tool.list_sessions.annotations)

  * [`destructiveHint`](https://libtmux.org/en/py/stable/mcp/reference/glossary/#destructiveHint)

    `true`

  * [`idempotentHint`](https://libtmux.org/en/py/stable/mcp/reference/glossary/#idempotentHint)

    `false`

  * [`openWorldHint`](https://libtmux.org/en/py/stable/mcp/reference/glossary/#openWorldHint)

    `true`

  * [`readOnlyHint`](https://libtmux.org/en/py/stable/mcp/reference/glossary/#readOnlyHint)

    `false`

  ## Protocol data[#](https://libtmux.org/en/py/stable/mcp/tools/list_sessions/#mcp.tool.list_sessions.schemas)

  Use the complete advertised contract for validation and client integration.

  Input schema

  ```json
  {
    "additionalProperties": false,
    "properties": {
      "filters": {
        "anyOf": [
          {
            "additionalProperties": {
              "type": "string"
            },
            "type": "object"
          },
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ],
        "default": null,
        "description": "Django-style filters as a dict (e.g. ``{\"session_name__contains\": \"dev\"}``)\nor as a JSON string. Some MCP clients require the string form."
      },
      "socket_name": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ],
        "default": null,
        "description": "tmux socket name. Defaults to LIBTMUX_SOCKET env var."
      }
    },
    "type": "object"
  }
  ```

  Output schema

  ```json
  {
    "properties": {
      "result": {
        "items": {
          "description": "Serialized tmux session.",
          "properties": {
            "active_pane_id": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "description": "Pane id (``%N``) of the session's active pane. Guaranteed non-None on ``create_session`` return (libtmux creates the session with one initial pane). May be None from ``list_sessions`` rows for sessions in transient teardown states where ``active_pane`` is unavailable."
            },
            "session_attached": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "description": "Attached client count"
            },
            "session_created": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "description": "Creation timestamp"
            },
            "session_id": {
              "description": "Session ID (e.g. '$1')",
              "type": "string"
            },
            "session_name": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "description": "Session name"
            },
            "window_count": {
              "description": "Number of windows",
              "type": "integer"
            }
          },
          "required": [
            "session_id",
            "window_count"
          ],
          "type": "object"
        },
        "type": "array"
      }
    },
    "required": [
      "result"
    ],
    "type": "object",
    "x-fastmcp-wrap-result": true
  }
  ```
