MCPcopy
hub / github.com/docker/docker-agent / addAgentMessage

Function addAgentMessage

pkg/runtime/tool_dispatch.go:153–157  ·  view source on GitHub ↗

addAgentMessage records a chat message in the session and emits the resulting MessageAdded event. Used by the loop for assistant messages and max-iteration stop messages. The dispatcher emits its own variant directly via the [toolexec.Emitter] interface.

(sess *session.Session, a *agent.Agent, msg *chat.Message, events EventSink)

Source from the content-addressed store, hash-verified

151// and max-iteration stop messages. The dispatcher emits its own variant
152// directly via the [toolexec.Emitter] interface.
153func addAgentMessage(sess *session.Session, a *agent.Agent, msg *chat.Message, events EventSink) {
154 agentMsg := session.NewAgentMessage(a.Name(), msg)
155 sess.AddMessage(agentMsg)
156 events.Emit(MessageAdded(sess.ID, agentMsg, a.Name()))
157}

Callers 4

enforceMaxIterationsMethod · 0.85

Calls 5

NewAgentMessageFunction · 0.92
MessageAddedFunction · 0.85
NameMethod · 0.65
AddMessageMethod · 0.65
EmitMethod · 0.65

Tested by

no test coverage detected