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

Method DeleteSession

server/handler_session.go:281–298  ·  view source on GitHub ↗

DeleteSession removes a saved session.

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

Source from the content-addressed store, hash-verified

279
280// DeleteSession removes a saved session.
281func (h *Handler) DeleteSession(ctx context.Context, req *pb.DeleteSessionRequest) (*pb.DeleteSessionResponse, error) {
282 if h.sessionManager == nil {
283 return nil, status.Errorf(codes.Unavailable, "%s", i18n.T("server.session.mgmt_unavailable"))
284 }
285
286 if req.Name == "" {
287 return nil, status.Errorf(codes.InvalidArgument, "%s", i18n.T("server.session.name_empty"))
288 }
289
290 if err := h.sessionManager.DeleteSession(req.Name); err != nil {
291 return nil, status.Errorf(codes.Internal, "%s", i18n.T("server.session.delete_error", err))
292 }
293
294 if h.sessionMetrics != nil {
295 h.sessionMetrics.OperationsTotal.WithLabelValues("delete").Inc()
296 }
297 return &pb.DeleteSessionResponse{Success: true}, nil
298}
299
300// executeRemoteCommand parses and executes a server-side command, returning the result string.
301func (h *Handler) executeRemoteCommand(rawCommand string) string {

Callers 1

Calls 3

TFunction · 0.92
ErrorfMethod · 0.80
DeleteSessionMethod · 0.65

Tested by 1