# list_sessions

Source: https://libtmux.org/en/ts/latest/mcp/tools/list_sessions/

> Inspect tmux metadata; accepts no client-supplied executable input. Every session on this server with its id, name, window count, and whether anyone is attached. Metadata only — for what a pane shows, use capture_pane or search_panes.

tool MCPlatest

MCP concept example

A working example of the core library. It can change without notice.

[What concept means](https://libtmux.org/en/meta/support/#concept-and-alpha)

* **list_sessions**()

  tool \[[source](https://github.com/libtmux/libtmux-ts/blob/46cccfef2a546de55ce8b308249b8c76339089a0/packages/mcp/src/tools/discovery.ts#L60)][¶](https://libtmux.org/en/ts/latest/mcp/tools/list_sessions/#mcp.tool.list_sessions)

  Inspect tmux metadata; accepts no client-supplied executable input. Every session on this server with its id, name, window count, and whether anyone is attached. Metadata only — for what a pane shows, use [capture_pane](https://libtmux.org/en/ts/latest/mcp/tools/capture_pane/) or [search_panes](https://libtmux.org/en/ts/latest/mcp/tools/search_panes/).

  * MCP request method

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

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

  No named arguments.

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

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

  * **[`complete`](https://libtmux.org/en/ts/latest/mcp/tools/list_sessions/#mcp.tool.list_sessions.output%2Fproperties%2Fcomplete)** ([boolean](https://json-schema.org/understanding-json-schema/reference/boolean "boolean (JSON Schema)"))

  * **[`omittedEntries`](https://libtmux.org/en/ts/latest/mcp/tools/list_sessions/#mcp.tool.list_sessions.output%2Fproperties%2FomittedEntries)** ([integer](https://json-schema.org/understanding-json-schema/reference/numeric "numeric (JSON Schema)"))

    * minimum

      `-9007199254740991`

    * maximum

      `9007199254740991`

  * **[`sessions`](https://libtmux.org/en/ts/latest/mcp/tools/list_sessions/#mcp.tool.list_sessions.output%2Fproperties%2Fsessions)** ([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/ts/latest/mcp/tools/list_sessions/#mcp.tool.list_sessions.output%2Fproperties%2Fsessions%2Fitems)** ([object](https://json-schema.org/understanding-json-schema/reference/object "object (JSON Schema)"))

      * **[`attachedClients`](https://libtmux.org/en/ts/latest/mcp/tools/list_sessions/#mcp.tool.list_sessions.output%2Fproperties%2Fsessions%2Fitems%2Fproperties%2FattachedClients)** ([integer](https://json-schema.org/understanding-json-schema/reference/numeric "numeric (JSON Schema)"))

        Raw client count from tmux; 0 means detached. Includes control-mode clients - this server’s own [wait_for_text](https://libtmux.org/en/ts/latest/mcp/tools/wait_for_text/) or other live read holds one open while it runs, and another program on this socket may hold others. See humanAttachedClients for a person-only count.

        * minimum

          `-9007199254740991`

        * maximum

          `9007199254740991`

      * **[`humanAttachedClients`](https://libtmux.org/en/ts/latest/mcp/tools/list_sessions/#mcp.tool.list_sessions.output%2Fproperties%2Fsessions%2Fitems%2Fproperties%2FhumanAttachedClients)** ([integer](https://json-schema.org/understanding-json-schema/reference/numeric "numeric (JSON Schema)"))

        attachedClients minus every control-mode client, this server’s own included.

        * minimum

          `-9007199254740991`

        * maximum

          `9007199254740991`

      * **[`id`](https://libtmux.org/en/ts/latest/mcp/tools/list_sessions/#mcp.tool.list_sessions.output%2Fproperties%2Fsessions%2Fitems%2Fproperties%2Fid)** ([string](https://json-schema.org/understanding-json-schema/reference/string "string (JSON Schema)"))

        Stable session id, e.g. $1.

        * pattern

          `"^\\$\\d+$"`

      * **[`metadataComplete`](https://libtmux.org/en/ts/latest/mcp/tools/list_sessions/#mcp.tool.list_sessions.output%2Fproperties%2Fsessions%2Fitems%2Fproperties%2FmetadataComplete)** ([boolean](https://json-schema.org/understanding-json-schema/reference/boolean "boolean (JSON Schema)"))

        Whether the session name is complete.

      * **[`name`](https://libtmux.org/en/ts/latest/mcp/tools/list_sessions/#mcp.tool.list_sessions.output%2Fproperties%2Fsessions%2Fitems%2Fproperties%2Fname)** ([string](https://json-schema.org/understanding-json-schema/reference/string "string (JSON Schema)"))

      * **[`omittedMetadataBytes`](https://libtmux.org/en/ts/latest/mcp/tools/list_sessions/#mcp.tool.list_sessions.output%2Fproperties%2Fsessions%2Fitems%2Fproperties%2FomittedMetadataBytes)** ([integer](https://json-schema.org/understanding-json-schema/reference/numeric "numeric (JSON Schema)"))

        UTF-8 bytes omitted from the session name.

        * minimum

          `0`

        * maximum

          `9007199254740991`

      * **[`windows`](https://libtmux.org/en/ts/latest/mcp/tools/list_sessions/#mcp.tool.list_sessions.output%2Fproperties%2Fsessions%2Fitems%2Fproperties%2Fwindows)** ([integer](https://json-schema.org/understanding-json-schema/reference/numeric "numeric (JSON Schema)"))

        How many windows it holds.

        * minimum

          `-9007199254740991`

        * maximum

          `9007199254740991`

      No other properties are accepted.

  No other properties are accepted.

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

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

    `true`

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

    `false`

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

    `true`

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

    `false`

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

  Use the complete advertised contract for validation and client integration.

  Input schema

  ```json
  {
    "$schema": "http://json-schema.org/draft-07/schema#",
    "properties": {},
    "type": "object"
  }
  ```

  Output schema

  ```json
  {
    "$schema": "http://json-schema.org/draft-07/schema#",
    "additionalProperties": false,
    "properties": {
      "complete": {
        "type": "boolean"
      },
      "omittedEntries": {
        "maximum": 9007199254740991,
        "minimum": -9007199254740991,
        "type": "integer"
      },
      "sessions": {
        "items": {
          "additionalProperties": false,
          "properties": {
            "attachedClients": {
              "description": "Raw client count from tmux; 0 means detached. Includes control-mode clients - this server's own wait_for_text or other live read holds one open while it runs, and another program on this socket may hold others. See humanAttachedClients for a person-only count.",
              "maximum": 9007199254740991,
              "minimum": -9007199254740991,
              "type": "integer"
            },
            "humanAttachedClients": {
              "description": "attachedClients minus every control-mode client, this server's own included.",
              "maximum": 9007199254740991,
              "minimum": -9007199254740991,
              "type": "integer"
            },
            "id": {
              "description": "Stable session id, e.g. $1.",
              "pattern": "^\\$\\d+$",
              "type": "string"
            },
            "metadataComplete": {
              "description": "Whether the session name is complete.",
              "type": "boolean"
            },
            "name": {
              "type": "string"
            },
            "omittedMetadataBytes": {
              "description": "UTF-8 bytes omitted from the session name.",
              "maximum": 9007199254740991,
              "minimum": 0,
              "type": "integer"
            },
            "windows": {
              "description": "How many windows it holds.",
              "maximum": 9007199254740991,
              "minimum": -9007199254740991,
              "type": "integer"
            }
          },
          "required": [
            "attachedClients",
            "humanAttachedClients",
            "id",
            "metadataComplete",
            "name",
            "omittedMetadataBytes",
            "windows"
          ],
          "type": "object"
        },
        "type": "array"
      }
    },
    "required": [
      "complete",
      "omittedEntries",
      "sessions"
    ],
    "type": "object"
  }
  ```
