Skip to main content
Glama
greirson

Todoist MCP Server

todoist_comment_create

Add comments to Todoist tasks by task ID or name to provide context, updates, or attachments for better task management.

Instructions

Add a comment to a task in Todoist by task ID or task name

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
task_idNoID of the task to comment on (provide this OR task_name)
task_nameNoName/content of the task to comment on (provide this OR task_id)
contentYesContent of the comment
attachmentNoOptional file attachment (optional)

Implementation Reference

  • The primary handler function implementing the todoist_comment_create tool. Resolves task by ID or name, validates/sanitizes content, handles optional attachments, calls Todoist API to add comment, clears cache, and returns formatted success message.
    export async function handleCreateComment(
      todoistClient: TodoistApi,
      args: CreateCommentArgs
    ): Promise<string> {
      return ErrorHandler.wrapAsync("create comment", async () => {
        // Validate and sanitize content
        const sanitizedContent = validateCommentContent(args.content);
    
        let taskId: string;
    
        // If task_id is provided, use it directly
        if (args.task_id) {
          taskId = args.task_id;
        } else if (args.task_name) {
          // Search for task by name
          const result = await todoistClient.getTasks();
          const tasks = extractArrayFromResponse<TodoistTask>(result);
          const matchingTask = tasks.find((task: TodoistTask) =>
            task.content.toLowerCase().includes(args.task_name!.toLowerCase())
          );
    
          if (!matchingTask) {
            ErrorHandler.handleTaskNotFound(args.task_name!);
          }
    
          taskId = matchingTask.id;
        } else {
          throw new Error("Either task_id or task_name must be provided");
        }
    
        const commentData: CommentCreationData = {
          content: sanitizedContent,
          taskId: taskId,
        };
    
        if (args.attachment) {
          commentData.attachment = {
            fileName: args.attachment.file_name,
            fileUrl: args.attachment.file_url,
            fileType: args.attachment.file_type,
          };
        }
    
        const comment = await todoistClient.addComment(commentData);
    
        // Clear cache after creating comment
        commentCache.clear();
    
        // Use defensive typing for comment response
        const commentResponse = comment as CommentResponse;
    
        return `Comment added to task:\nContent: ${commentResponse.content}${
          commentResponse.attachment
            ? `\nAttachment: ${commentResponse.attachment.fileName} (${commentResponse.attachment.fileType})`
            : ""
        }\nPosted at: ${commentResponse.postedAt || new Date().toISOString()}`;
      });
    }
  • Tool definition including name, description, and detailed input schema for todoist_comment_create.
    export const CREATE_COMMENT_TOOL: Tool = {
      name: "todoist_comment_create",
      description: "Add a comment to a task in Todoist by task ID or task name",
      inputSchema: {
        type: "object",
        properties: {
          task_id: {
            type: "string",
            description: "ID of the task to comment on (provide this OR task_name)",
          },
          task_name: {
            type: "string",
            description:
              "Name/content of the task to comment on (provide this OR task_id)",
          },
          content: {
            type: "string",
            description: "Content of the comment",
          },
          attachment: {
            type: "object",
            description: "Optional file attachment (optional)",
            properties: {
              file_name: {
                type: "string",
                description: "Name of the attached file",
              },
              file_url: {
                type: "string",
                description: "URL of the attached file",
              },
              file_type: {
                type: "string",
                description: "MIME type of the attached file",
              },
            },
            required: ["file_name", "file_url", "file_type"],
          },
        },
        required: ["content"],
      },
    };
  • Includes COMMENT_TOOLS (containing todoist_comment_create) in the ALL_TOOLS array provided to the MCP server for tool listing.
    export const ALL_TOOLS = [
      ...TASK_TOOLS,
      ...PROJECT_TOOLS,
      ...COMMENT_TOOLS,
      ...LABEL_TOOLS,
      ...SUBTASK_TOOLS,
      ...TEST_TOOLS,
    ];
  • src/index.ts:240-245 (registration)
    Switch case in central CallToolRequest handler that validates args and dispatches to the specific handleCreateComment implementation.
    case "todoist_comment_create":
      if (!isCreateCommentArgs(args)) {
        throw new Error("Invalid arguments for todoist_comment_create");
      }
      result = await handleCreateComment(apiClient, args);
      break;
  • Runtime type guard validating tool input arguments match CreateCommentArgs interface (used in dispatcher).
    export function isCreateCommentArgs(args: unknown): args is CreateCommentArgs {
      if (typeof args !== "object" || args === null) return false;
    
      const obj = args as Record<string, unknown>;
      return (
        "content" in obj &&
        typeof obj.content === "string" &&
        (obj.task_id === undefined || typeof obj.task_id === "string") &&
        (obj.task_name === undefined || typeof obj.task_name === "string") &&
        (obj.task_id !== undefined || obj.task_name !== undefined)
      );
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states the action ('Add a comment') which implies a write operation, but doesn't mention required permissions, rate limits, whether comments are editable/deletable, or what happens on success/failure. This leaves significant gaps for a mutation tool.

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 communicates the core functionality without unnecessary words. It's appropriately front-loaded with the main action and resource, making it easy to parse quickly.

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

Completeness2/5

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

For a mutation tool with no annotations and no output schema, the description is insufficient. It doesn't address behavioral aspects like error conditions, response format, or side effects. While concise, it lacks the completeness needed for an agent to understand the tool's full implications.

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%, providing complete parameter documentation. The description adds minimal value beyond the schema by mentioning the task identification methods ('by task ID or task name'), but doesn't elaborate on parameter interactions or usage nuances. This meets the baseline for high schema coverage.

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 ('Add a comment') and target resource ('to a task in Todoist'), with specificity about identification methods ('by task ID or task name'). However, it doesn't explicitly differentiate from sibling tools like todoist_comment_get, which would require mentioning this is for creation rather than retrieval.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives, such as todoist_task_update for task modifications or todoist_comment_get for retrieving comments. It mentions identification methods but doesn't address context-specific usage scenarios or prerequisites.

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

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