move_task
Move a task between projects in Todoist to reorganize your workflow. Specify the task ID and destination project ID to transfer tasks.
Instructions
Move a task from one project to another
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| task_id | Yes | The task ID to move | |
| project_id | Yes | The project ID to move the task to |
Implementation Reference
- src/tools/task-operations.ts:258-303 (handler)The async handler function that executes the 'move_task' tool logic. It validates input arguments, calls the underlying moveTask service function, handles success/error responses, and returns structured content.handler: async (args: { task_id: string; project_id: string; }): Promise<{ content: Array<{ type: 'text'; text: string; }>; }> => { console.error('Executing move_task...'); const { task_id, project_id } = args; if (!task_id) { throw new Error('task_id is required'); } if (!project_id) { throw new Error('project_id is required'); } try { await moveTask(task_id, project_id); console.error('move_task completed successfully'); return { content: [ { type: 'text', text: `Task ${task_id} successfully moved to project ${project_id}`, }, ], }; } catch (error) { console.error('move_task error:', error); return { content: [ { type: 'text', text: `Error: ${ error instanceof Error ? error.message : 'Unknown error' }`, }, ], }; } },
- src/tools/task-operations.ts:240-257 (schema)The JSON schema definition for the 'move_task' tool, specifying name, description, input properties, and required fields.schema: { name: 'move_task', description: 'Move a task from one project to another', inputSchema: { type: 'object', properties: { task_id: { type: 'string', description: 'The task ID to move', }, project_id: { type: 'string', description: 'The project ID to move the task to', }, }, required: ['task_id', 'project_id'], }, },
- src/handlers/tool-request-handler.ts:50-64 (registration)Registration of the move_task tool handler in the toolsWithArgs registry, mapping 'move_task' to moveTaskTool.handler for execution.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, };
- The core helper function that performs the task move operation using Todoist V1 API after converting IDs to V1 format.export async function moveTask( taskId: string, projectId: string ): Promise<void> { try { // Convert v2 IDs to v1 format const v1TaskId = await convertV2IdToV1('tasks', taskId); const v1ProjectId = await convertV2IdToV1('projects', projectId); // Move the task using v1 API const client = getTodoistV1Client(); await client.post(`/api/v1/tasks/${v1TaskId}/move`, { project_id: v1ProjectId, }); } catch (error) { throw new Error(`Failed to move task: ${getErrorMessage(error)}`); } }