Skip to main content
Glama

Todoist MCP

by Doist
import type { AddCommentArgs, TodoistApi } from '@doist/todoist-api-typescript' import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js' import { z } from 'zod' export function registerAddComment(server: McpServer, api: TodoistApi) { server.tool( 'add-comment', 'Add a comment to a task or project', { taskId: z.string().optional().describe('Task ID to add comment to'), projectId: z.string().optional().describe('Project ID to add comment to'), content: z.string().describe('Comment content'), attachment: z .object({ fileName: z.string().optional(), fileUrl: z.string(), fileType: z.string().optional(), resourceType: z.string().optional(), }) .optional() .describe('Attachment for the comment'), }, async ({ taskId, projectId, content, attachment }) => { // Ensure one and only one of taskId or projectId is provided if ((!taskId && !projectId) || (taskId && projectId)) { throw new Error('You must provide exactly one of taskId or projectId') } // Create comment arguments with required projectId or taskId let commentArgs: AddCommentArgs if (taskId) { commentArgs = { content, taskId, } } else if (projectId) { commentArgs = { content, projectId, } } else { // This should never happen due to the earlier validation throw new Error('You must provide exactly one of taskId or projectId') } if (attachment) { commentArgs.attachment = attachment } const comment = await api.addComment(commentArgs) return { content: [{ type: 'text', text: JSON.stringify(comment, null, 2) }], } }, ) }

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

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