get_todays_tasks
Retrieve tasks due today from TickTick, optionally filtered by project, to help users manage their daily priorities and deadlines.
Instructions
Get tasks that are specifically due today
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | No | Optional project ID to filter today's tasks |
Implementation Reference
- src/ticktick-client.ts:232-237 (handler)Core handler function that fetches raw tasks, filters for today's due tasks using the isTaskDueToday helper, enhances them for display, and returns the result.
async getTodaysTasks(projectId?: string): Promise<any[]> { // Get raw tasks for filtering logic const allTasks = await this.getTasksRaw(projectId); const todaysTasks = allTasks.filter(task => isTaskDueToday(task)); return todaysTasks.map(task => enhanceTaskForDisplay(task)); } - src/ticktick-client.ts:36-72 (helper)Supporting helper that determines if a task is due today, accounting for completion status, all-day flags, and timezone adjustments by adding one day to the due date.
function isTaskDueToday(task: TickTickTask): boolean { // If task is completed, it's not due today if (task.completedTime) { return false; } // If no due date, it's not due today if (!task.dueDate) { return false; } try { // Get current date/time const now = new Date(); // Parse due date and add 1 day to compensate for timezone difference const dueDate = new Date(task.dueDate); const adjustedDueDate = new Date(dueDate.getTime() + (24 * 60 * 60 * 1000)); // Add 1 day // If it's an all-day task, compare dates only if (task.allDay) { const today = now.toISOString().split('T')[0]; const adjustedDueDateStr = adjustedDueDate.toISOString().split('T')[0]; // Task is due today if adjusted due date equals today return adjustedDueDateStr === today; } // For timed tasks, check if it's due today (same date) const today = now.toISOString().split('T')[0]; const adjustedDueDateStr = adjustedDueDate.toISOString().split('T')[0]; return adjustedDueDateStr === today; } catch (error) { // If date parsing fails, assume not due today return false; } } - src/index.ts:69-81 (schema)Tool schema definition including name, description, and input schema for optional projectId parameter.
{ name: 'get_todays_tasks', description: 'Get tasks that are specifically due today', inputSchema: { type: 'object', properties: { projectId: { type: 'string', description: 'Optional project ID to filter today\'s tasks', }, }, }, }, - src/index.ts:248-257 (registration)Registration and dispatch handler in the MCP CallToolRequestSchema switch statement that calls the client implementation and formats the response.
case 'get_todays_tasks': const todaysTasks = await this.ticktickClient!.getTodaysTasks(args?.projectId as string); return { content: [ { type: 'text', text: JSON.stringify(todaysTasks, null, 2), }, ], }; - src/ticktick-client.ts:5-33 (helper)Helper utility to enhance task objects with human-readable priority text for better display.
function enhanceTaskForDisplay(task: TickTickTask): any { const enhanced = { ...task }; // Add human-readable priority let priorityText = 'None'; switch (task.priority) { case 0: priorityText = 'None'; break; case 1: priorityText = 'Low'; break; case 3: priorityText = 'Medium'; break; case 5: priorityText = 'High'; break; default: priorityText = task.priority ? `Custom (${task.priority})` : 'None'; } return { ...enhanced, priorityText, // Keep original dates for display - they should show correctly dueDate: task.dueDate }; }