Skip to main content
Glama

create_subtask

Break down complex tasks into precise, actionable subtasks with detailed specifications and clear ownership, enabling granular progress tracking and team coordination within hierarchical project structures.

Instructions

Break down complex tasks into precise, actionable subtasks with detailed specifications and clear ownership. Enable granular progress tracking and team coordination by decomposing work into manageable, measurable components within your hierarchical project structure.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
detailsYesDetailed description of what the subtask involves
nameYesThe name/title of the new subtask
taskIdYesThe ID of the parent task this subtask belongs to
workingDirectoryYesThe full absolute path to the working directory where data is stored. MUST be an absolute path, never relative. Windows: "C:\Users\username\project" or "D:\projects\my-app". Unix/Linux/macOS: "/home/username/project" or "/Users/username/project". Do NOT use: ".", "..", "~", "./folder", "../folder" or any relative paths. Ensure the path exists and is accessible before calling this tool. NOTE: When server is started with --claude flag, this parameter is ignored and a global user directory is used instead.

Implementation Reference

  • The async handler function that implements the core logic of the 'create_subtask' tool: input validation, task existence check, duplicate name prevention, subtask creation via storage, and formatted success response.
        handler: async ({ name, details, taskId }: { name: string; details: string; taskId: string }) => {
          try {
            // Validate inputs
            if (!name || name.trim().length === 0) {
              return {
                content: [{
                  type: 'text' as const,
                  text: 'Error: Subtask name is required.'
                }],
                isError: true
              };
            }
    
            if (name.trim().length > 100) {
              return {
                content: [{
                  type: 'text' as const,
                  text: 'Error: Subtask name must be 100 characters or less.'
                }],
                isError: true
              };
            }
    
            if (!details || details.trim().length === 0) {
              return {
                content: [{
                  type: 'text' as const,
                  text: 'Error: Subtask details are required.'
                }],
                isError: true
              };
            }
    
            if (details.trim().length > 1000) {
              return {
                content: [{
                  type: 'text' as const,
                  text: 'Error: Subtask details must be 1000 characters or less.'
                }],
                isError: true
              };
            }
    
            if (!taskId || taskId.trim().length === 0) {
              return {
                content: [{
                  type: 'text' as const,
                  text: 'Error: Task ID is required.'
                }],
                isError: true
              };
            }
    
            // Validate that task exists
            const task = await storage.getTask(taskId.trim());
            if (!task) {
              return {
                content: [{
                  type: 'text' as const,
                  text: `Error: Task with ID "${taskId}" not found. Use list_tasks to see all available tasks.`
                }],
                isError: true
              };
            }
    
            // Get project information
            const project = await storage.getProject(task.projectId);
            const projectName = project ? project.name : 'Unknown Project';
    
            // Check for duplicate subtask names within the same task
            const existingSubtasks = await storage.getSubtasks(taskId);
            const nameExists = existingSubtasks.some(s => s.name.toLowerCase() === name.toLowerCase());
    
            if (nameExists) {
              return {
                content: [{
                  type: 'text' as const,
                  text: `Error: A subtask with the name "${name}" already exists in task "${task.name}". Please choose a different name.`
                }],
                isError: true
              };
            }
    
            const now = new Date().toISOString();
            const subtask: Subtask = {
              id: randomUUID(),
              name: name.trim(),
              details: details.trim(),
              taskId,
              projectId: task.projectId,
              completed: false,
              createdAt: now,
              updatedAt: now
            };
    
            const createdSubtask = await storage.createSubtask(subtask);
    
            return {
              content: [{
                type: 'text' as const,
                text: `✅ Subtask created successfully!
    
    **${createdSubtask.name}** (ID: ${createdSubtask.id})
    Task: ${task.name}
    Project: ${projectName}
    Details: ${createdSubtask.details}
    Status: Pending
    Created: ${new Date(createdSubtask.createdAt).toLocaleString()}
    
    You can mark this subtask as completed using update_subtask.`
              }]
            };
          } catch (error) {
            return {
              content: [{
                type: 'text' as const,
                text: `Error creating subtask: ${error instanceof Error ? error.message : 'Unknown error'}`
              }],
              isError: true
            };
          }
        }
  • Input schema using Zod for validating tool parameters: name, details, taskId.
    inputSchema: {
      name: z.string(),
      details: z.string(),
      taskId: z.string()
    },
  • Factory function that creates and configures the 'create_subtask' tool object (with name, description, schema, handler) for registration in the MCP tools list.
    export function createCreateSubtaskTool(storage: Storage) {
      return {
        name: 'create_subtask',
        description: 'Create a new subtask within a specific task',
        inputSchema: {
          name: z.string(),
          details: z.string(),
          taskId: z.string()
        },
        handler: async ({ name, details, taskId }: { name: string; details: string; taskId: string }) => {
          try {
            // Validate inputs
            if (!name || name.trim().length === 0) {
              return {
                content: [{
                  type: 'text' as const,
                  text: 'Error: Subtask name is required.'
                }],
                isError: true
              };
            }
    
            if (name.trim().length > 100) {
              return {
                content: [{
                  type: 'text' as const,
                  text: 'Error: Subtask name must be 100 characters or less.'
                }],
                isError: true
              };
            }
    
            if (!details || details.trim().length === 0) {
              return {
                content: [{
                  type: 'text' as const,
                  text: 'Error: Subtask details are required.'
                }],
                isError: true
              };
            }
    
            if (details.trim().length > 1000) {
              return {
                content: [{
                  type: 'text' as const,
                  text: 'Error: Subtask details must be 1000 characters or less.'
                }],
                isError: true
              };
            }
    
            if (!taskId || taskId.trim().length === 0) {
              return {
                content: [{
                  type: 'text' as const,
                  text: 'Error: Task ID is required.'
                }],
                isError: true
              };
            }
    
            // Validate that task exists
            const task = await storage.getTask(taskId.trim());
            if (!task) {
              return {
                content: [{
                  type: 'text' as const,
                  text: `Error: Task with ID "${taskId}" not found. Use list_tasks to see all available tasks.`
                }],
                isError: true
              };
            }
    
            // Get project information
            const project = await storage.getProject(task.projectId);
            const projectName = project ? project.name : 'Unknown Project';
    
            // Check for duplicate subtask names within the same task
            const existingSubtasks = await storage.getSubtasks(taskId);
            const nameExists = existingSubtasks.some(s => s.name.toLowerCase() === name.toLowerCase());
    
            if (nameExists) {
              return {
                content: [{
                  type: 'text' as const,
                  text: `Error: A subtask with the name "${name}" already exists in task "${task.name}". Please choose a different name.`
                }],
                isError: true
              };
            }
    
            const now = new Date().toISOString();
            const subtask: Subtask = {
              id: randomUUID(),
              name: name.trim(),
              details: details.trim(),
              taskId,
              projectId: task.projectId,
              completed: false,
              createdAt: now,
              updatedAt: now
            };
    
            const createdSubtask = await storage.createSubtask(subtask);
    
            return {
              content: [{
                type: 'text' as const,
                text: `✅ Subtask created successfully!
    
    **${createdSubtask.name}** (ID: ${createdSubtask.id})
    Task: ${task.name}
    Project: ${projectName}
    Details: ${createdSubtask.details}
    Status: Pending
    Created: ${new Date(createdSubtask.createdAt).toLocaleString()}
    
    You can mark this subtask as completed using update_subtask.`
              }]
            };
          } catch (error) {
            return {
              content: [{
                type: 'text' as const,
                text: `Error creating subtask: ${error instanceof Error ? error.message : 'Unknown error'}`
              }],
              isError: true
            };
          }
        }
      };
    }
  • TypeScript interface defining the CreateSubtaskInput type, matching the tool's input schema.
    export interface CreateSubtaskInput {
      /** Subtask name */
      name: string;
      /** Enhanced subtask description */
      details: string;
      /** Reference to parent task */
      taskId: string;
    }
  • File-based storage implementation for persisting the subtask, called by the tool handler.
    async createSubtask(subtask: Subtask): Promise<Subtask> {
      if (!this.data.subtasks) this.data.subtasks = [];
      this.data.subtasks.push(subtask);
      await this.save();
      return subtask;
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It describes the tool's function ('break down complex tasks into subtasks') and benefits ('granular progress tracking, team coordination'), but lacks critical behavioral details: whether this is a mutation (likely, given 'create'), what permissions are required, if it's idempotent, error conditions, or what the response looks like (no output schema). For a creation tool with zero annotation coverage, this is inadequate.

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

Conciseness4/5

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

The description is appropriately concise (two sentences) and front-loaded with the core purpose. Every sentence adds value: the first defines the action, and the second explains benefits. There's no fluff or repetition, though it could be slightly more direct by starting with 'Create a subtask...' instead of 'Break down...'

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 tool's complexity (creation/mutation with 4 required parameters), lack of annotations, and no output schema, the description is incomplete. It doesn't address behavioral aspects like side effects, error handling, or response format, leaving the agent to guess. For a mutation tool in a project management context, more guidance on usage and outcomes is needed.

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%, so the schema fully documents all 4 parameters (name, details, taskId, workingDirectory). The description adds no parameter-specific semantics beyond what's in the schema—it doesn't explain how 'details' differs from 'name', what format 'taskId' expects, or constraints on 'workingDirectory'. Baseline 3 is appropriate when 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 tool's purpose: 'Break down complex tasks into precise, actionable subtasks with detailed specifications and clear ownership.' It specifies the verb ('break down') and resource ('complex tasks into subtasks'), but doesn't explicitly distinguish it from sibling tools like 'create_task' or 'migrate_subtasks', which also involve task/subtask creation or manipulation.

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?

The description provides no guidance on when to use this tool versus alternatives. It mentions enabling 'granular progress tracking and team coordination' but doesn't specify prerequisites, exclusions, or compare it to siblings like 'create_task' (for top-level tasks) or 'migrate_subtasks' (for moving subtasks). The agent must infer usage from the name and context alone.

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

Related 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/Pimzino/agentic-tools-mcp'

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