Skip to main content
Glama

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
NameRequiredDescriptionDefault
task_idYesTask ID to comment on
contentYesComment text
authorNoAuthor name (optional)

Implementation Reference

  • 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;
    }
  • 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'],
      },
    },
  • The registration of the 'comment_add' handler within the handlers object.
    export const handlers: Record<string, ToolHandler> = {
      comment_add: handleCommentAdd,
      comment_list: handleCommentList,
    };

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/spranab/saga-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server