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

Method GetSessionMetadata

go/client.go:1279–1295  ·  view source on GitHub ↗

GetSessionMetadata returns metadata for a specific session by ID. This provides an efficient O(1) lookup of a single session's metadata instead of listing all sessions. Returns nil if the session is not found. Example: metadata, err := client.GetSessionMetadata(context.Background(), "session-123

(ctx context.Context, sessionID string)

Source from the content-addressed store, hash-verified

1277// fmt.Printf("Session started at: %s\n", metadata.StartTime)
1278// }
1279func (c *Client) GetSessionMetadata(ctx context.Context, sessionID string) (*SessionMetadata, error) {
1280 if err := c.ensureConnected(ctx); err != nil {
1281 return nil, err
1282 }
1283
1284 result, err := c.client.Request(ctx, "session.getMetadata", getSessionMetadataRequest{SessionID: sessionID})
1285 if err != nil {
1286 return nil, err
1287 }
1288
1289 var response getSessionMetadataResponse
1290 if err := json.Unmarshal(result, &response); err != nil {
1291 return nil, fmt.Errorf("failed to unmarshal session metadata response: %w", err)
1292 }
1293
1294 return response.Session, nil
1295}
1296
1297// DeleteSession permanently deletes a session and all its data from disk,
1298// including conversation history, planning state, and artifacts.

Callers 2

TestClientAPIE2EFunction · 0.95
TestSessionE2EFunction · 0.95

Calls 2

ensureConnectedMethod · 0.95
RequestMethod · 0.45

Tested by 2

TestClientAPIE2EFunction · 0.76
TestSessionE2EFunction · 0.76