get_todays_tasks
Retrieve tasks due today from the TickTick task management service, optionally filtered by project ID, to stay organized and meet deadlines.
Instructions
Get tasks that are specifically due today
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | No | Optional project ID to filter today's tasks |
Implementation Reference
- src/index.ts:248-257 (handler)MCP tool handler for 'get_todays_tasks' that invokes TickTickClient.getTodaysTasks with optional projectId and returns the JSON-stringified result.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/index.ts:69-81 (schema)Input schema definition for the 'get_todays_tasks' tool, specifying 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/ticktick-client.ts:232-237 (helper)Core helper method in TickTickClient that fetches raw tasks and filters for those due today using isTaskDueToday, then enhances for display.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)Key helper function that determines if a task is due today, handling all-day tasks, timezone adjustment by adding 1 day, and filtering out completed tasks.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/ticktick-client.ts:5-33 (helper)Helper function that enhances tasks with human-readable priority text for better display in responses.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 }; }