Skip to main content
Glama

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
NameRequiredDescriptionDefault
task_idYesThe task ID to move
project_idYesThe project ID to move the task to

Implementation Reference

  • 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'
              }`,
            },
          ],
        };
      }
    },
  • 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'],
      },
    },
  • 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)}`);
      }
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/bkotos/todoist-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server