@@ -64,6 +64,13 @@ export class AgentSideConnection {
6464 const validatedParams = validate . zLoadSessionRequest . parse ( params ) ;
6565 return agent . loadSession ( validatedParams ) ;
6666 }
67+ case schema . AGENT_METHODS . session_list : {
68+ if ( ! agent . unstable_listSessions ) {
69+ throw RequestError . methodNotFound ( method ) ;
70+ }
71+ const validatedParams = validate . zListSessionsRequest . parse ( params ) ;
72+ return agent . unstable_listSessions ( validatedParams ) ;
73+ }
6774 case schema . AGENT_METHODS . session_fork : {
6875 if ( ! agent . unstable_forkSession ) {
6976 throw RequestError . methodNotFound ( method ) ;
@@ -640,6 +647,30 @@ export class ClientSideConnection implements Agent {
640647 ) ;
641648 }
642649
650+ /**
651+ * **UNSTABLE**
652+ *
653+ * This capability is not part of the spec yet, and may be removed or changed at any point.
654+ *
655+ * Lists existing sessions from the agent.
656+ *
657+ * This method is only available if the agent advertises the `listSessions` capability.
658+ *
659+ * Returns a list of sessions with metadata like session ID, working directory,
660+ * title, and last update time. Supports filtering by working directory and
661+ * cursor-based pagination.
662+ *
663+ * @experimental
664+ */
665+ async unstable_listSessions (
666+ params : schema . ListSessionsRequest ,
667+ ) : Promise < schema . ListSessionsResponse > {
668+ return await this . #connection. sendRequest (
669+ schema . AGENT_METHODS . session_list ,
670+ params ,
671+ ) ;
672+ }
673+
643674 /**
644675 * **UNSTABLE**
645676 *
@@ -1450,6 +1481,22 @@ export interface Agent {
14501481 unstable_forkSession ?(
14511482 params : schema . ForkSessionRequest ,
14521483 ) : Promise < schema . ForkSessionResponse > ;
1484+ /**
1485+ * **UNSTABLE**
1486+ *
1487+ * This capability is not part of the spec yet, and may be removed or changed at any point.
1488+ *
1489+ * Lists existing sessions from the agent.
1490+ *
1491+ * This method is only available if the agent advertises the `listSessions` capability.
1492+ *
1493+ * Returns a list of sessions with metadata like session ID, working directory,
1494+ * title, and last update time. Supports filtering by working directory and
1495+ * cursor-based pagination.
1496+ */
1497+ unstable_listSessions ?(
1498+ params : schema . ListSessionsRequest ,
1499+ ) : Promise < schema . ListSessionsResponse > ;
14531500 /**
14541501 * **UNSTABLE**
14551502 *
0 commit comments