Skip to main content
Glama
greirson

Todoist MCP Server

todoist_task_convert_to_subtask

Convert an existing task into a subtask under another task in Todoist to organize related items hierarchically.

Instructions

Convert an existing task to a subtask of another task

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
task_idNoID of the task to convert (provide this OR task_name)
task_nameNoName/content of the task to convert (provide this OR task_id)
parent_task_idNoID of the parent task (provide this OR parent_task_name)
parent_task_nameNoName/content of the parent task (provide this OR parent_task_id)

Implementation Reference

  • Core handler function that implements the tool logic: locates the task and parent task, validates it's not already a subtask, deletes the original task, and recreates it as a subtask under the parent while preserving properties.
    export async function handleConvertToSubtask(
      todoistClient: TodoistApi,
      args: ConvertToSubtaskArgs
    ): Promise<{ task: TodoistTask; parent: TodoistTask }> {
      try {
        // Find both tasks
        const [task, parent] = await Promise.all([
          findTask(todoistClient, {
            task_id: args.task_id,
            task_name: args.task_name,
          }),
          findTask(todoistClient, {
            task_id: args.parent_task_id,
            task_name: args.parent_task_name,
          }),
        ]);
    
        // Check if already a subtask
        if (task.parentId) {
          throw new ValidationError(`Task "${task.content}" is already a subtask`);
        }
    
        // Delete the original task and recreate it as a subtask
        // This is a workaround since updateTask may not support parentId
        await todoistClient.deleteTask(task.id);
    
        const subtaskData: TaskCreationData = {
          content: task.content,
          parentId: parent.id,
          projectId: parent.projectId || task.projectId,
        };
    
        // Preserve other task properties
        if (task.description) subtaskData.description = task.description;
        if (task.due?.string) subtaskData.dueString = task.due.string;
        if (task.priority) subtaskData.priority = task.priority;
        if (task.labels) subtaskData.labels = task.labels;
        if (task.deadline?.date)
          subtaskData.deadline = { date: task.deadline.date };
    
        const updatedTask = (await todoistClient.addTask(
          subtaskData
        )) as TodoistTask;
    
        // Clear cache
        taskCache.clear();
    
        return { task: updatedTask, parent };
      } catch (error) {
        throw ErrorHandler.handleAPIError("convertToSubtask", error);
      }
    }
  • Defines the tool's metadata including name, description, and input schema specifying parameters for task identification (ID or name for both task to convert and parent).
    export const CONVERT_TO_SUBTASK_TOOL: Tool = {
      name: "todoist_task_convert_to_subtask",
      description: "Convert an existing task to a subtask of another task",
      inputSchema: {
        type: "object",
        properties: {
          task_id: {
            type: "string",
            description: "ID of the task to convert (provide this OR task_name)",
          },
          task_name: {
            type: "string",
            description:
              "Name/content of the task to convert (provide this OR task_id)",
          },
          parent_task_id: {
            type: "string",
            description: "ID of the parent task (provide this OR parent_task_name)",
          },
          parent_task_name: {
            type: "string",
            description:
              "Name/content of the parent task (provide this OR parent_task_id)",
          },
        },
      },
    };
  • src/index.ts:324-332 (registration)
    Tool registration in the main server request handler: matches tool name, validates arguments using type guard, invokes the handler, and formats success response.
    case "todoist_task_convert_to_subtask":
      if (!isConvertToSubtaskArgs(args)) {
        throw new Error(
          "Invalid arguments for todoist_task_convert_to_subtask"
        );
      }
      const convertResult = await handleConvertToSubtask(apiClient, args);
      result = `Converted task "${convertResult.task.content}" (ID: ${convertResult.task.id}) to subtask of "${convertResult.parent.content}" (ID: ${convertResult.parent.id})`;
      break;
  • Aggregates all tools including SUBTASK_TOOLS (containing todoist_task_convert_to_subtask) into ALL_TOOLS array exposed to the MCP server.
    export const ALL_TOOLS = [
      ...TASK_TOOLS,
      ...PROJECT_TOOLS,
      ...COMMENT_TOOLS,
      ...LABEL_TOOLS,
      ...SUBTASK_TOOLS,
      ...TEST_TOOLS,
    ];
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It states the tool converts a task to a subtask, implying a mutation, but doesn't disclose behavioral traits such as permission requirements, whether the conversion is reversible, effects on task properties, or error conditions. For a mutation tool with zero annotation coverage, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's function. It is front-loaded with the core action and resource, with zero wasted words. Every part of the sentence earns its place by conveying essential information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a mutation tool with no annotations and no output schema, the description is incomplete. It lacks information on behavioral aspects (e.g., side effects, permissions), output format, error handling, and usage context. For a tool that modifies task relationships, more detail is needed to ensure safe and correct use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with clear parameter descriptions in the schema (e.g., 'ID of the task to convert'). The description adds no additional meaning beyond the schema, such as explaining the relationship between task_id/task_name or parent_task_id/parent_task_name. Baseline 3 is appropriate as the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('convert') and resource ('existing task'), specifying it becomes a 'subtask of another task'. It distinguishes from siblings like todoist_task_create (new task) and todoist_subtask_create (new subtask), but doesn't explicitly contrast with todoist_subtask_promote (which moves subtask to task). The purpose is specific but could be more differentiated.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives is provided. It doesn't mention prerequisites (e.g., tasks must exist), when not to use it (e.g., for new subtasks), or compare with siblings like todoist_subtask_create or todoist_task_update. The description implies usage but offers no explicit context or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/greirson/mcp-todoist'

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