Skip to main content
Glama
vitalio-sh

Enhanced Todoist MCP Server Extended

todoist_get_comments

Retrieve comments for Todoist tasks or projects with pagination support to view and manage discussion threads.

Instructions

Get comments for a task or project with pagination support

Input Schema

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

Implementation Reference

  • The main handler function for the todoist_get_comments tool. Validates arguments with isCommentsArgs, calls todoistClient.getComments with taskId/projectId/cursor/limit, formats results using formatComment, and handles pagination and errors.
    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 like taskId/projectId (mutually exclusive), cursor, and 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 available 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,
      ],
    }));
  • Type guard function isCommentsArgs used in the handler to validate input arguments, 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');
    }
  • Helper function formatComment used to format comment objects for output in the tool response.
    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;
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden. It discloses pagination behavior ('with pagination support'), which is valuable beyond the input schema. However, it doesn't mention authentication requirements, rate limits, error conditions, or what the return format looks like (comments structure, metadata). For a read operation with 4 parameters, this leaves significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose ('Get comments for a task or project') and adds essential behavioral context ('with pagination support'). Every word earns its place with zero redundancy or wasted verbiage.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 4 parameters, no annotations, and no output schema, the description provides basic purpose and pagination context but lacks important details: no authentication/rate limit information, no return format description, and no guidance on error handling. For a moderately complex read operation in this context, the description is minimally adequate but has clear gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents all 4 parameters. The description adds no parameter-specific information beyond what's in the schema. According to scoring rules, when schema coverage is high (>80%), the baseline is 3 even with no param info in description, which applies here.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get comments') and target resource ('for a task or project'), distinguishing it from sibling tools like todoist_get_comment (singular) and todoist_create_comment. However, it doesn't explicitly differentiate from other read operations like todoist_get_task or todoist_get_project, which reduces specificity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for retrieving comments with pagination, but provides no explicit guidance on when to use this versus alternatives like todoist_get_comment (singular) or general search tools. The input schema descriptions offer some parameter-level guidance (taskId vs projectId), but the tool description itself lacks context about typical use cases or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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

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