MCPcopy Index your code
hub / github.com/github/copilot-sdk / listSessions

Method listSessions

nodejs/src/client.ts:1935–1962  ·  view source on GitHub ↗

* List all available sessions. * * @param filter - Optional filter to limit returned sessions by context fields * * @example * // List all sessions * const sessions = await client.listSessions(); * * @example * // List sessions for a specific repository

(filter?: SessionListFilter)

Source from the content-addressed store, hash-verified

1933 * const sessions = await client.listSessions({ repository: "owner/repo" });
1934 */
1935 async listSessions(filter?: SessionListFilter): Promise<SessionMetadata[]> {
1936 if (!this.connection) {
1937 throw new Error("Client not connected");
1938 }
1939
1940 // Transform filter to wire format (workingDirectory → cwd)
1941 let wireFilter: Record<string, unknown> | undefined;
1942 if (filter) {
1943 const { workingDirectory, ...rest } = filter;
1944 wireFilter = { ...rest, cwd: workingDirectory };
1945 }
1946
1947 const response = await this.connection.sendRequest("session.list", {
1948 filter: wireFilter,
1949 });
1950 const { sessions } = response as {
1951 sessions: Array<{
1952 sessionId: string;
1953 startTime: string;
1954 modifiedTime: string;
1955 summary?: string;
1956 isRemote: boolean;
1957 context?: { cwd: string; gitRoot?: string; repository?: string; branch?: string };
1958 }>;
1959 };
1960
1961 return sessions.map(CopilotClient.toSessionMetadata);
1962 }
1963
1964 /**
1965 * Gets metadata for a specific session by ID.

Calls 1

sendRequestMethod · 0.45

Tested by

no test coverage detected