comment_add
Add comments to tasks to create chronological discussion threads, enabling persistent tracking of project conversations across sessions.
Instructions
Add a comment to a task. Comments create a chronological discussion thread — useful for leaving breadcrumbs across sessions.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| task_id | Yes | Task ID to comment on | |
| content | Yes | Comment text | |
| author | No | Author name (optional) |
Implementation Reference
- src/tools/comments.ts:36-55 (handler)The handler function that executes the logic for adding a comment to a task.
function handleCommentAdd(args: Record<string, unknown>) { const db = getDb(); const taskId = args.task_id as number; const content = args.content as string; const author = (args.author as string) ?? null; // Verify task exists const task = db.prepare('SELECT id, title FROM tasks WHERE id = ?').get(taskId) as { id: number; title: string } | undefined; if (!task) throw new Error(`Task ${taskId} not found`); const comment = db .prepare('INSERT INTO comments (task_id, author, content) VALUES (?, ?, ?) RETURNING *') .get(taskId, author, content); const row = comment as Record<string, unknown>; logActivity(db, 'comment', row.id as number, 'created', null, null, null, `Comment added to task '${task.title}'${author ? ` by ${author}` : ''}`); return comment; } - src/tools/comments.ts:7-21 (schema)The MCP tool definition and input schema for the 'comment_add' tool.
{ name: 'comment_add', description: 'Add a comment to a task. Comments create a chronological discussion thread — useful for leaving breadcrumbs across sessions.', annotations: { title: 'Add Comment', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false }, inputSchema: { type: 'object', properties: { task_id: { type: 'integer', description: 'Task ID to comment on' }, content: { type: 'string', description: 'Comment text' }, author: { type: 'string', description: 'Author name (optional)' }, }, required: ['task_id', 'content'], }, }, - src/tools/comments.ts:66-69 (registration)The registration of the 'comment_add' handler within the handlers object.
export const handlers: Record<string, ToolHandler> = { comment_add: handleCommentAdd, comment_list: handleCommentList, };