***

title: list_sessions
slug: /reference/python/agents/mcp-gateway/session-manager/list-sessions
description: List all active sessions with their metadata.
max-toc-depth: 3
---------------------

For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

List all active sessions with their metadata. Expired and dead sessions are
automatically cleaned up during this call. Returns a dictionary keyed by
session ID, where each value contains `service_name`, `created_at`,
`last_accessed`, `timeout`, `metadata`, and `time_remaining`.

## **Parameters**

None.

## **Returns**

`dict[str, dict[str, Any]]` -- A dictionary mapping session IDs to session info dictionaries.

## **Example**

```python {4}
from signalwire.mcp_gateway import SessionManager

manager = SessionManager(config)
sessions = manager.list_sessions()
for session_id, info in sessions.items():
    print(f"{session_id}: {info['service_name']} ({info['time_remaining']:.0f}s remaining)")
```