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

Method handleGetConversation

internal/httpapi/conversations.go:186–214  ·  view source on GitHub ↗
(ctx context.Context, in *ConversationIDParam)

Source from the content-addressed store, hash-verified

184}
185
186func (s *Server) handleGetConversation(ctx context.Context, in *ConversationIDParam) (*conversationOutput, error) {
187 ag, err := s.resolveOwnedAgent(ctx, in.Address)
188 if err != nil {
189 return nil, err
190 }
191 if len(in.ConversationID) > maxFilterStr {
192 return nil, NewError(http.StatusBadRequest, "invalid_request", "conversation_id too long (max 200 chars)")
193 }
194 if err := validateConversationID(in.ConversationID); err != nil {
195 return nil, NewError(http.StatusBadRequest, "invalid_request", err.Error())
196 }
197 if s.deps.GetConversation == nil {
198 return nil, NewError(http.StatusInternalServerError, "internal_error", "conversation lookup unavailable")
199 }
200 detail, err := s.deps.GetConversation(ctx, ag.ID, in.ConversationID)
201 if err != nil || detail == nil {
202 return nil, NewError(http.StatusNotFound, "not_found", "conversation not found")
203 }
204 out := &conversationOutput{Body: ConversationDetailView{
205 ConversationSummaryView: conversationSummaryView(detail.ConversationSummary),
206 Participants: orEmptyStrings(detail.Participants),
207 Labels: orEmptyStrings(detail.Labels),
208 Messages: make([]MessageSummaryView, len(detail.Messages)),
209 }}
210 for i, m := range detail.Messages {
211 out.Body.Messages[i] = messageSummaryFromIdentity(m)
212 }
213 return out, nil
214}

Callers

nothing calls this directly

Calls 8

resolveOwnedAgentMethod · 0.95
NewErrorFunction · 0.85
conversationSummaryViewFunction · 0.85
orEmptyStringsFunction · 0.85
makeFunction · 0.85
validateConversationIDFunction · 0.70
ErrorMethod · 0.45

Tested by

no test coverage detected