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

Method loadInbound

internal/httpapi/outbound.go:221–238  ·  view source on GitHub ↗

loadInbound resolves the owned agent + the inbound message (404 if missing or not on this agent).

(ctx context.Context, address, msgID string)

Source from the content-addressed store, hash-verified

219// loadInbound resolves the owned agent + the inbound message (404 if missing
220// or not on this agent).
221func (s *Server) loadInbound(ctx context.Context, address, msgID string) (*identity.AgentIdentity, *identity.Message, *identity.User, error) {
222 ag, err := s.resolveOwnedAgent(ctx, address)
223 if err != nil {
224 return nil, nil, nil, err
225 }
226 user, uerr := s.requireUser(ctx)
227 if uerr != nil {
228 return nil, nil, nil, uerr
229 }
230 if s.deps.GetInboundMessage == nil {
231 return nil, nil, nil, NewError(http.StatusInternalServerError, "internal_error", "outbound unavailable")
232 }
233 in, err := s.deps.GetInboundMessage(ctx, msgID)
234 if err != nil || in == nil || in.AgentID != ag.ID {
235 return nil, nil, nil, NewError(http.StatusNotFound, "not_found", "message not found")
236 }
237 return ag, in, user, nil
238}
239
240func (s *Server) handleReply(ctx context.Context, in *replyInput) (*sendOutput, error) {
241 ag, inbound, user, err := s.loadInbound(ctx, in.Address, in.ID)

Callers 2

handleReplyMethod · 0.95
handleForwardMethod · 0.95

Calls 4

resolveOwnedAgentMethod · 0.95
requireUserMethod · 0.95
NewErrorFunction · 0.85
GetInboundMessageMethod · 0.80

Tested by

no test coverage detected