Skip to main content
Glama
kydycode

Enhanced Todoist MCP Server Extended

todoist_get_comments

Retrieve comments for a specific task or project, including pagination support, to manage and review feedback efficiently within your Todoist workflow.

Instructions

Get comments for a task or project with pagination support

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cursorNoPagination cursor for next page (optional)
limitNoMaximum number of comments to return (optional)
projectIdNoProject ID to get comments for (provide either taskId or projectId, not both)
taskIdNoTask ID to get comments for (provide either taskId or projectId, not both)

Implementation Reference

  • The main handler logic for the 'todoist_get_comments' tool within the CallToolRequestSchema request handler. It validates arguments using isCommentsArgs, calls todoistClient.getComments(), formats the results with formatComment, supports pagination, and returns formatted text output.
    if (name === "todoist_get_comments") { if (!isCommentsArgs(args)) { return { content: [{ type: "text", text: "Invalid arguments for get_comments. Provide either taskId or projectId, not both." }], isError: true }; } try { const params: any = {}; if (args.taskId) params.taskId = args.taskId; if (args.projectId) params.projectId = args.projectId; if (args.cursor) params.cursor = args.cursor; if (args.limit) params.limit = args.limit; const commentsResponse = await todoistClient.getComments(params); const commentList = commentsResponse.results?.map(formatComment).join('\n\n') || 'No comments found'; const nextCursor = commentsResponse.nextCursor ? `\n\nNext cursor for more comments: ${commentsResponse.nextCursor}` : ''; return { content: [{ type: "text", text: `Comments:\n${commentList}${nextCursor}` }], isError: false }; } catch (error: any) { return { content: [{ type: "text", text: `Error getting comments: ${error.message}` }], isError: true }; } }
  • Tool schema definition including name, description, and inputSchema for validating parameters (taskId or projectId, cursor, limit).
    const GET_COMMENTS_TOOL: Tool = { name: "todoist_get_comments", description: "Get comments for a task or project with pagination support", inputSchema: { type: "object", properties: { taskId: { type: "string", description: "Task ID to get comments for (provide either taskId or projectId, not both)" }, projectId: { type: "string", description: "Project ID to get comments for (provide either taskId or projectId, not both)" }, cursor: { type: "string", description: "Pagination cursor for next page (optional)" }, limit: { type: "number", description: "Maximum number of comments to return (optional)" } } } };
  • src/index.ts:1083-1121 (registration)
    Registration of the todoist_get_comments tool (as GET_COMMENTS_TOOL) in the list of tools returned by ListToolsRequestSchema handler.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [ // Task tools CREATE_TASK_TOOL, QUICK_ADD_TASK_TOOL, GET_TASKS_TOOL, GET_TASK_TOOL, UPDATE_TASK_TOOL, DELETE_TASK_TOOL, COMPLETE_TASK_TOOL, REOPEN_TASK_TOOL, SEARCH_TASKS_TOOL, MOVE_TASK_TOOL, BULK_MOVE_TASKS_TOOL, // Project tools GET_PROJECTS_TOOL, GET_PROJECT_TOOL, CREATE_PROJECT_TOOL, UPDATE_PROJECT_TOOL, DELETE_PROJECT_TOOL, // Section tools GET_SECTIONS_TOOL, CREATE_SECTION_TOOL, UPDATE_SECTION_TOOL, DELETE_SECTION_TOOL, // Label tools CREATE_LABEL_TOOL, GET_LABEL_TOOL, GET_LABELS_TOOL, UPDATE_LABEL_TOOL, DELETE_LABEL_TOOL, // Comment tools CREATE_COMMENT_TOOL, GET_COMMENT_TOOL, GET_COMMENTS_TOOL, UPDATE_COMMENT_TOOL, DELETE_COMMENT_TOOL, ], }));
  • Helper function formatComment used by the handler to format individual comments for output display.
    function formatComment(comment: any): string { let commentDetails = `- ID: ${comment.id}\n Content: ${comment.content}`; if (comment.postedAt) commentDetails += `\n Posted At: ${comment.postedAt}`; if (comment.taskId) commentDetails += `\n Task ID: ${comment.taskId}`; if (comment.projectId) commentDetails += `\n Project ID: ${comment.projectId}`; if (comment.attachment) { commentDetails += `\n Attachment: ${comment.attachment.fileName || 'File'} (${comment.attachment.fileType})`; if (comment.attachment.fileUrl) commentDetails += `\n File URL: ${comment.attachment.fileUrl}`; } return commentDetails; }
  • Type guard helper isCommentsArgs for validating the input arguments to the todoist_get_comments tool, ensuring exactly one of taskId or projectId is provided.
    function isCommentsArgs(args: unknown): args is { taskId?: string; projectId?: string; cursor?: string; limit?: number; } { if (typeof args !== "object" || args === null) { return false; } const { taskId, projectId } = args as any; const targets = [taskId, projectId]; const providedTargets = targets.filter(target => target !== undefined && target !== null && String(target).trim() !== ''); // Exactly one target must be provided and be a non-empty string, or no targets (for all comments) return providedTargets.length <= 1 && providedTargets.every(target => typeof target === 'string'); }

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/kydycode/todoist-mcp-server-ext'

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