get_overdue_tasks
Retrieve all overdue tasks (incomplete tasks past their due date) from the TickTick task management service, optionally filtered by project ID, with timezone offset support.
Instructions
Get all overdue tasks (incomplete tasks past their due date)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | No | Optional project ID to filter overdue tasks | |
| timezoneOffsetHours | No | Timezone offset in hours from UTC (e.g., 8 for UTC+8). Defaults to 8 |
Implementation Reference
- src/index.ts:236-246 (handler)MCP tool dispatch handler for 'get_overdue_tasks' that extracts parameters, calls the TickTickClient method, and returns JSON-formatted response.case 'get_overdue_tasks': const timezoneOffsetHours = args?.timezoneOffsetHours as number || 8; const overdueTasks = await this.ticktickClient!.getOverdueTasks(args?.projectId as string, timezoneOffsetHours); return { content: [ { type: 'text', text: JSON.stringify(overdueTasks, null, 2), }, ], };
- src/index.ts:52-68 (schema)Tool schema definition and registration in the list of available tools, including input schema with projectId and timezoneOffsetHours parameters.{ name: 'get_overdue_tasks', description: 'Get all overdue tasks (incomplete tasks past their due date)', inputSchema: { type: 'object', properties: { projectId: { type: 'string', description: 'Optional project ID to filter overdue tasks', }, timezoneOffsetHours: { type: 'number', description: 'Timezone offset in hours from UTC (e.g., 8 for UTC+8). Defaults to 8', }, }, }, },
- src/ticktick-client.ts:225-230 (helper)Core helper method in TickTickClient that fetches tasks, filters overdue ones using isTaskOverdue, enhances for display, and returns them.async getOverdueTasks(projectId?: string, timezoneOffsetHours: number = 8): Promise<any[]> { // Get raw tasks for filtering logic const allTasks = await this.getTasksRaw(projectId); const overdueTasks = allTasks.filter(task => isTaskOverdue(task, timezoneOffsetHours)); return overdueTasks.map(task => enhanceTaskForDisplay(task)); }
- src/ticktick-client.ts:75-110 (helper)Key helper function that determines if a task is overdue, accounting for completion status, due dates, all-day flags, and timezone adjustments with +1 day offset.function isTaskOverdue(task: TickTickTask, timezoneOffsetHours: number = 8): boolean { // If task is completed, it's not overdue if (task.completedTime) { return false; } // If no due date, it's not overdue 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) { // Get today's date in YYYY-MM-DD format const today = now.toISOString().split('T')[0]; const adjustedDueDateStr = adjustedDueDate.toISOString().split('T')[0]; // Task is overdue if adjusted due date is before today return adjustedDueDateStr < today; } // For timed tasks, compare datetime directly return adjustedDueDate < now; } catch (error) { // If date parsing fails, assume not overdue return false; } }