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

Function addAnnotationHandler

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

Source from the content-addressed store, hash-verified

360 * POST /sessions/:id/annotations - Add annotation to session.
361 */
362const addAnnotationHandler: RouteHandler = async (req, res, params) => {
363 try {
364 const body = await parseBody<Omit<Annotation, "id" | "sessionId" | "status" | "createdAt">>(req);
365
366 if (!body.comment || !body.element || !body.elementPath) {
367 return sendError(res, 400, "comment, element, and elementPath are required");
368 }
369
370 const annotation = addAnnotation(params.id, body);
371
372 if (!annotation) {
373 return sendError(res, 404, "Session not found");
374 }
375
376 sendJson(res, 201, annotation);
377 } catch (err) {
378 sendError(res, 400, (err as Error).message);
379 }
380};
381
382/**
383 * PATCH /annotations/:id - Update an annotation.

Callers

nothing calls this directly

Calls 3

sendErrorFunction · 0.85
sendJsonFunction · 0.85
addAnnotationFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…