get_tasks_with_label
Retrieve tasks filtered by a specific label, excluding those from Brian or Projects projects. Returns structured JSON with task details including content, priority, due dates, and completion status.
Instructions
Get all tasks with a specific label that are not part of the "Brian projects" or "Projects" projects. Returns structured JSON data with task details including id, content, description, completion status, labels, priority, due date, and comment count.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| label | Yes | The label to filter tasks by (e.g., "urgent", "important", "work") |
Implementation Reference
- src/tools/task-queries.ts:97-127 (handler)Primary implementation of the 'get_tasks_with_label' tool: defines schema for input validation and handler function that executes the tool logic by calling the service and formatting response as JSON.export const getTasksWithLabelTool: Tool = { schema: { name: 'get_tasks_with_label', description: 'Get all tasks with a specific label that are not part of the "Brian projects" or "Projects" projects. Returns structured JSON data with task details including id, content, description, completion status, labels, priority, due date, and comment count.', inputSchema: { type: 'object', properties: { label: { type: 'string', description: 'The label to filter tasks by (e.g., "urgent", "important", "work")', }, }, required: ['label'], }, }, handler: async (args: { label: string }) => { console.error('Executing get_tasks_with_label...'); const result = await getTasksWithLabel(args.label); console.error('get_tasks_with_label completed successfully'); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }, };
- Helper service function that constructs Todoist filter for tasks with given label (excluding projects unless context label) and fetches/transforms tasks.export async function getTasksWithLabel(label: string): Promise<TasksResponse> { const filter = label.startsWith('context:') ? `@${label}` : `@${label} & !##Brian projects & !##Projects`; return await fetchTasksByFilter(filter, 'get tasks with label'); }
- src/handlers/tool-request-handler.ts:50-64 (registration)Registration of the tool handler in the toolsWithArgs registry map, mapping 'get_tasks_with_label' to its handler function.const toolsWithArgs: Record<string, (args: any) => Promise<ToolResponse>> = { get_task_comments: getTaskCommentsTool.handler, create_project_label: createProjectLabelTool.handler, create_task_comment: createTaskCommentTool.handler, update_task: updateTaskTool.handler, create_task: createTaskTool.handler, move_task: moveTaskTool.handler, get_tasks_with_label: getTasksWithLabelTool.handler, complete_task: completeTaskTool.handler, uncomplete_task: uncompleteTaskTool.handler, search_tasks: searchTasksTool.handler, search_tasks_using_and: searchTasksUsingAndTool.handler, search_tasks_using_or: searchTasksUsingOrTool.handler, complete_becky_task: completeBeckyTaskTool.handler, };
- src/index.ts:97-97 (registration)Registration of the tool schema in MCP ListToolsRequestHandler response array.getTasksWithLabelTool.schema,
- src/tools/task-queries.ts:98-113 (schema)Schema definition for the tool, including name, description, and inputSchema for validation (requires 'label' string).schema: { name: 'get_tasks_with_label', description: 'Get all tasks with a specific label that are not part of the "Brian projects" or "Projects" projects. Returns structured JSON data with task details including id, content, description, completion status, labels, priority, due date, and comment count.', inputSchema: { type: 'object', properties: { label: { type: 'string', description: 'The label to filter tasks by (e.g., "urgent", "important", "work")', }, }, required: ['label'], }, },