session/list method allows Clients to discover sessions known to an Agent. Clients can use this to display session history and switch between sessions.
Agents can also push session metadata updates to Clients in real-time via the session_info_update notification, keeping session titles and metadata in sync without polling.
Before listing sessions, Clients MUST first complete the initialization phase to verify the Agent supports this capability.
Checking Support
Before attempting to list sessions, Clients MUST verify that the Agent supports this capability by checking thesessionCapabilities.list field in the initialize response:
sessionCapabilities.list is not present, the Agent does not support listing sessions and Clients MUST NOT attempt to call session/list.
Listing Sessions
Clients discover existing sessions by calling thesession/list method with optional filtering and pagination parameters:
params object returns the first page of sessions.
Filter sessions by working directory. Must be an absolute path. Only sessions
with a matching
cwd are returned.Opaque cursor token from a previous response’s
nextCursor field for
cursor-based pagination. See Pagination.Array of session information objects.
Opaque cursor token. If present, pass this in the next request’s
cursor
parameter to fetch the next page. If absent, there are no more results.sessions array.
Pagination
session/list uses cursor-based pagination. The request includes an optional cursor, and the response includes nextCursor when more results are available.
- Clients MUST treat a missing
nextCursoras the end of results - Clients MUST treat cursors as opaque tokens — do not parse, modify, or persist them
- Agents SHOULD return an error if the cursor is invalid
- Agents SHOULD enforce reasonable page sizes internally
Updating Session Metadata
Agents can update session metadata in real-time by sending asession_info_update notification via session/update. This follows the same pattern as other session notifications like available_commands_update and current_mode_update.
Human-readable title for the session. Set to
null to clear.ISO 8601 timestamp of last activity. Set to
null to clear.Agent-specific metadata. See Extensibility.
sessionId and cwd fields are not included in the update — sessionId is already in the notification’s params, and cwd is immutable (set during session/new). Agents typically send this notification after the first meaningful exchange to auto-generate a title.
Interaction with Other Session Methods
session/list is a discovery mechanism only — it does not restore or modify sessions:
- Client calls
session/listto discover available sessions - User selects a session from the list
- Client calls
session/loadwith the chosensessionIdto resume the conversation