MCPcopy
hub / github.com/benjitaylor/agentation / addThreadMessage

Function addThreadMessage

mcp/src/server/store.ts:197–224  ·  view source on GitHub ↗
(
      annotationId: string,
      role: "human" | "agent",
      content: string
    )

Source from the content-addressed store, hash-verified

195 },
196
197 addThreadMessage(
198 annotationId: string,
199 role: "human" | "agent",
200 content: string
201 ): Annotation | undefined {
202 const annotation = annotations.get(annotationId);
203 if (!annotation) return undefined;
204
205 const message: ThreadMessage = {
206 id: generateId(),
207 role,
208 content,
209 timestamp: Date.now(),
210 };
211
212 if (!annotation.thread) {
213 annotation.thread = [];
214 }
215 annotation.thread.push(message);
216 annotation.updatedAt = new Date().toISOString();
217
218 if (annotation.sessionId) {
219 const event = eventBus.emit("thread.message", annotation.sessionId, message);
220 events.push(event);
221 }
222
223 return annotation;
224 },
225
226 getPendingAnnotations(sessionId: string): Annotation[] {
227 return Array.from(annotations.values()).filter(

Callers 1

addThreadHandlerFunction · 0.70

Calls 4

getStoreFunction · 0.85
emitMethod · 0.80
addThreadMessageMethod · 0.80
generateIdFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…