MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / HandleDashboardAgents

Method HandleDashboardAgents

internal/auth/auth.go:590–609  ·  view source on GitHub ↗

HandleDashboardAgents lists agents owned by the authenticated user.

(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

588
589// HandleDashboardAgents lists agents owned by the authenticated user.
590func (ua *UserAuth) HandleDashboardAgents(w http.ResponseWriter, r *http.Request) {
591 user := ua.AuthenticateRequest(r)
592 if user == nil {
593 http.Error(w, "not authenticated", http.StatusUnauthorized)
594 return
595 }
596
597 agents, err := ua.store.ListAgentsByUser(r.Context(), user.ID)
598 if err != nil {
599 http.Error(w, "failed to list agents", http.StatusInternalServerError)
600 return
601 }
602
603 if agents == nil {
604 agents = []identity.AgentIdentity{}
605 }
606
607 w.Header().Set("Content-Type", "application/json")
608 writeJSON(w, map[string][]identity.AgentIdentity{"agents": agents})
609}
610
611// HandleDeleteAgent deletes an agent owned by the authenticated user.
612func (ua *UserAuth) HandleDeleteAgent(w http.ResponseWriter, r *http.Request) {

Callers

nothing calls this directly

Calls 4

AuthenticateRequestMethod · 0.95
ListAgentsByUserMethod · 0.80
writeJSONFunction · 0.70
ErrorMethod · 0.45

Tested by

no test coverage detected