Skip to main content
Glama

get_task_comments

Retrieve all comments for a specific Todoist task to view discussion history, attachments, and user details in structured JSON format.

Instructions

Get all comments for a specific Todoist task. Returns structured JSON data with comment details including id, content, posted date, user ID, and any attachments.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
task_idYesThe ID of the task to get comments for

Implementation Reference

  • The handler function for the 'get_task_comments' MCP tool. It validates input, calls the getTaskComments service, and formats the response as MCP content.
    handler: async (args: { task_id: string }) => { console.error('Executing get_task_comments...'); const { task_id } = args; if (!task_id) { throw new Error('task_id is required'); } const result = await getTaskComments(task_id); console.error('get_task_comments completed successfully'); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; },
  • The schema definition for the 'get_task_comments' tool, including name, description, and input schema requiring 'task_id'.
    schema: { name: 'get_task_comments', description: 'Get all comments for a specific Todoist task. Returns structured JSON data with comment details including id, content, posted date, user ID, and any attachments.', inputSchema: { type: 'object', properties: { task_id: { type: 'string', description: 'The ID of the task to get comments for', }, }, required: ['task_id'], }, },
  • Registration of the tool handler in the toolsWithArgs registry, mapping 'get_task_comments' to getTaskCommentsTool.handler for execution.
    const toolsWithArgs: Record<string, (args: any) => Promise<ToolResponse>> = { get_task_comments: getTaskCommentsTool.handler, create_project_label: createProjectLabelTool.handler, create_task_comment: createTaskCommentTool.handler, update_task: updateTaskTool.handler, create_task: createTaskTool.handler, move_task: moveTaskTool.handler, get_tasks_with_label: getTasksWithLabelTool.handler, complete_task: completeTaskTool.handler, uncomplete_task: uncompleteTaskTool.handler, search_tasks: searchTasksTool.handler, search_tasks_using_and: searchTasksUsingAndTool.handler, search_tasks_using_or: searchTasksUsingOrTool.handler, complete_becky_task: completeBeckyTaskTool.handler, };
  • src/index.ts:82-82 (registration)
    Registration of the tool schema in the ListToolsRequestHandler response array.
    getTaskCommentsTool.schema,
  • The core getTaskComments helper function that fetches comments from the Todoist API using the client, maps the response, and handles errors.
    export async function getTaskComments( taskId: string ): Promise<CommentsResponse> { const todoistClient = getTodoistClient(); try { const response = await todoistClient.get<TodoistComment[]>( `/comments?task_id=${taskId}` ); const comments = response.data.map((comment) => ({ id: parseInt(comment.id), content: comment.content, posted: comment.posted, posted_uid: comment.posted_uid, attachment: comment.attachment, })); return { comments, total_count: comments.length, }; } catch (error) { throw new Error(`Failed to get task comments: ${getErrorMessage(error)}`); } }

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/bkotos/todoist-mcp'

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