MCPcopy Create free account
hub / github.com/diillson/chatcli / ListSessions

Method ListSessions

server/handler_session.go:191–205  ·  view source on GitHub ↗

ListSessions returns all saved session names.

(ctx context.Context, req *pb.ListSessionsRequest)

Source from the content-addressed store, hash-verified

189
190// ListSessions returns all saved session names.
191func (h *Handler) ListSessions(ctx context.Context, req *pb.ListSessionsRequest) (*pb.ListSessionsResponse, error) {
192 if h.sessionManager == nil {
193 return nil, status.Errorf(codes.Unavailable, "%s", i18n.T("server.session.mgmt_unavailable"))
194 }
195
196 sessions, err := h.sessionManager.ListSessions()
197 if err != nil {
198 return nil, status.Errorf(codes.Internal, "%s", i18n.T("server.session.list_error", err))
199 }
200
201 if h.sessionMetrics != nil {
202 h.sessionMetrics.OperationsTotal.WithLabelValues("list").Inc()
203 }
204 return &pb.ListSessionsResponse{Sessions: sessions}, nil
205}
206
207// LoadSession loads a saved session.
208func (h *Handler) LoadSession(ctx context.Context, req *pb.LoadSessionRequest) (*pb.LoadSessionResponse, error) {

Callers 2

TestHandler_ListSessionsFunction · 0.95

Calls 3

TFunction · 0.92
ErrorfMethod · 0.80
ListSessionsMethod · 0.65

Tested by 2

TestHandler_ListSessionsFunction · 0.76