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

Function addThreadHandler

mcp/src/server/http.ts:507–525  ·  view source on GitHub ↗
(req, res, params)

Source from the content-addressed store, hash-verified

505 * POST /annotations/:id/thread - Add a thread message.
506 */
507const addThreadHandler: RouteHandler = async (req, res, params) => {
508 try {
509 const body = await parseBody<{ role: "human" | "agent"; content: string }>(req);
510
511 if (!body.role || !body.content) {
512 return sendError(res, 400, "role and content are required");
513 }
514
515 const annotation = addThreadMessage(params.id, body.role, body.content);
516
517 if (!annotation) {
518 return sendError(res, 404, "Annotation not found");
519 }
520
521 sendJson(res, 201, annotation);
522 } catch (err) {
523 sendError(res, 400, (err as Error).message);
524 }
525};
526
527/**
528 * GET /sessions/:id/events - SSE stream of events for a session.

Callers

nothing calls this directly

Calls 3

sendErrorFunction · 0.85
sendJsonFunction · 0.85
addThreadMessageFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…