Skip to main content
Glama
greirson

Todoist MCP Server

todoist_subtask_create

Create a subtask under a parent task in Todoist. Specify parent by ID or name, set content, priority, labels, and due date.

Instructions

Create a new subtask under a parent task in Todoist

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
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)
contentYesContent of the subtask
descriptionNoDescription of the subtask (optional)
due_stringNoHuman-readable due date string (e.g., 'tomorrow', 'next Monday')
priorityNoPriority level 1 (highest) to 4 (lowest)
labelsNoArray of label names to apply to the subtask
deadline_dateNoDeadline date in YYYY-MM-DD format

Implementation Reference

  • Tool definition/schema for todoist_subtask_create - defines name, description, and inputSchema with all parameters (parent_task_id, parent_task_name, content, etc.)
    // Subtask management tools for hierarchical task operations
    import { Tool } from "@modelcontextprotocol/sdk/types.js";
    
    export const CREATE_SUBTASK_TOOL: Tool = {
      name: "todoist_subtask_create",
      description: "Create a new subtask under a parent task in Todoist",
      inputSchema: {
        type: "object",
        properties: {
          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)",
          },
          content: {
            type: "string",
            description: "Content of the subtask",
          },
          description: {
            type: "string",
            description: "Description of the subtask (optional)",
          },
          due_string: {
            type: "string",
            description:
              "Human-readable due date string (e.g., 'tomorrow', 'next Monday')",
          },
          priority: {
            type: "number",
            description: "Priority level 1 (highest) to 4 (lowest)",
            minimum: 1,
            maximum: 4,
          },
          labels: {
            type: "array",
            items: { type: "string" },
            description: "Array of label names to apply to the subtask",
          },
          deadline_date: {
            type: "string",
            description: "Deadline date in YYYY-MM-DD format",
          },
        },
        required: ["content"],
      },
  • Core handler function handleCreateSubtask - validates inputs, finds parent task via findTask(), constructs TaskCreationData, calls todoistClient.addTask(), clears cache, and returns {subtask, parent}
    export async function handleCreateSubtask(
      todoistClient: TodoistApi,
      args: CreateSubtaskArgs
    ): Promise<{ subtask: TodoistTask; parent: TodoistTask }> {
      try {
        // Validate required fields
        validateTaskContent(args.content);
    
        // Find parent task
        const parent = await findTask(todoistClient, {
          task_id: args.parent_task_id,
          task_name: args.parent_task_name,
        });
    
        // Validate optional fields
        if (args.priority !== undefined) {
          validatePriority(args.priority);
        }
        if (args.deadline_date) {
          validateDateString(args.deadline_date, "deadline");
        }
    
        // Create subtask with parentId
        const subtaskData: TaskCreationData = {
          content: args.content,
          parentId: parent.id,
          projectId: parent.projectId,
        };
    
        if (args.description) subtaskData.description = args.description;
        if (args.due_string) subtaskData.dueString = args.due_string;
        const apiPriority = toApiPriority(args.priority);
        if (apiPriority !== undefined) subtaskData.priority = apiPriority;
        if (args.labels) subtaskData.labels = args.labels;
        if (args.deadline_date) subtaskData.deadline = { date: args.deadline_date };
    
        const subtask = (await todoistClient.addTask(subtaskData)) as TodoistTask;
    
        // Clear cache
        taskCache.clear();
    
        return { subtask, parent };
      } catch (error) {
        throw ErrorHandler.handleAPIError("createSubtask", error);
      }
    }
  • TypeScript interface CreateSubtaskArgs defining the shape of input arguments (parent_task_id?, parent_task_name?, content, description?, due_string?, priority?, labels?, deadline_date?)
    export interface CreateSubtaskArgs {
      parent_task_id?: string;
      parent_task_name?: string;
      content: string;
      description?: string;
      due_string?: string;
      priority?: number;
      labels?: string[];
      deadline_date?: string;
    }
  • Route registration in legacy-router.ts - dispatches 'todoist_subtask_create' to handleCreateSubtask via type guard and returns formatted result string
    case "todoist_subtask_create": {
      if (!isCreateSubtaskArgs(args)) {
        throw new Error("Invalid arguments for todoist_subtask_create");
      }
      const subtaskResult = await handleCreateSubtask(client, args);
      return `Created subtask "${subtaskResult.subtask.content}" (ID: ${subtaskResult.subtask.id}) under parent task "${subtaskResult.parent.content}" (ID: ${subtaskResult.parent.id})`;
    }
  • Type guard isCreateSubtaskArgs - validates runtime arguments (content must be string, parent_task_id or parent_task_name must be provided)
    export function isCreateSubtaskArgs(args: unknown): args is CreateSubtaskArgs {
      if (typeof args !== "object" || args === null) return false;
    
      const obj = args as Record<string, unknown>;
      return (
        "content" in obj &&
        typeof obj.content === "string" &&
        (obj.parent_task_id === undefined ||
          typeof obj.parent_task_id === "string") &&
        (obj.parent_task_name === undefined ||
          typeof obj.parent_task_name === "string") &&
        (obj.parent_task_id !== undefined || obj.parent_task_name !== undefined)
      );
    }
Behavior2/5

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

No annotations provided. Description only states the action but does not disclose behavioral traits like mutation, validation of parent existence, error handling, or return value.

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?

Single sentence, front-loaded, no redundancy. Efficiently communicates core purpose.

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?

Despite simple operation, description lacks return info, error cases, and required permissions. Incomplete for safe usage without annotations.

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?

Input schema has 100% description coverage. The description adds no extra meaning beyond the schema, meeting the baseline for high coverage.

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

Purpose5/5

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

Description clearly states verb 'Create', resource 'subtask', and context 'under a parent task'. It distinguishes from siblings like todoist_task_create and todoist_subtask_promote.

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 vs alternatives (e.g., when to create a task vs subtask). No prerequisites or conditions mentioned.

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