Skip to main content
Glama

get_task_comments

Retrieve structured JSON data of all comments for a specific Todoist task, including content, posted date, user ID, and attachments, by providing the task ID.

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 that implements the core logic of the 'get_task_comments' tool. It extracts and validates the task_id argument, calls the getTaskComments service function, and returns the result as a formatted JSON text block in the MCP content format.
    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 a task_id string.
    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 get_task_comments tool handler in the toolsWithArgs registry, which is used by handleToolRequest to dispatch tool calls with arguments.
    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, };
  • The helper service function getTaskComments that fetches comments for a Todoist task using the Todoist API client, maps the response to a structured format, 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)}`); } }
  • src/index.ts:82-82 (registration)
    Registration of the get_task_comments tool schema in the list of available tools returned by ListToolsRequestSchema handler.
    getTaskCommentsTool.schema,

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