Skip to main content
Glama
blizzy78

Task Manager MCP Server

by blizzy78

Decompose task

decompose_task

Break down complex tasks into manageable subtasks with verification steps, enabling parallel execution and structured workflow management.

Instructions

Decomposes an existing complex task into smaller, more manageable subtasks. All tasks with complexity higher than low must always be decomposed before execution. Tasks MUST be in todo status to be decomposed. Subtasks with the same sequence order may be executed in parallel. Subtasks should include a verification subtask. Created subtasks may be decomposed later if needed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
taskIDYesThe task to decompose
decompositionReasonYesThe reason for decomposing this task
subtasksYesArray of smaller, manageable subtasks to create

Implementation Reference

  • The handleDecomposeTask function is the core handler for the decompose_task tool. It creates subtasks from the provided args, organizes them into sequence orders for parallel execution where applicable, sets up dependencies between sequences, updates the task database, modifies the parent task to depend on the final subtasks, and returns structured results including notifications if further decomposition is needed.
    export async function handleDecomposeTask(
      { taskID, subtasks }: DecomposeTaskArgs,
      taskDB: TaskDB,
      singleAgent: boolean
    ) {
      const parentTask = taskDB.get(taskID)
      if (!parentTask) {
        throw new Error(`Task not found: ${taskID}`)
      }
    
      if (parentTask.status !== TodoStatus) {
        throw new Error(`Can't decompose task ${taskID} in status: ${parentTask.status}`)
      }
    
      const seqOrderToTasks = new Map<number, Array<Task>>()
    
      for (const subtask of subtasks) {
        const newTask = {
          taskID: newTaskID(),
          status: TodoStatus,
          dependsOnTaskIDs: [],
    
          title: subtask.title,
          description: subtask.description,
          goal: subtask.goal,
          definitionsOfDone: subtask.definitionsOfDone,
          criticalPath: !!subtask.criticalPath,
          uncertaintyAreas: subtask.uncertaintyAreas,
          estimatedComplexity: subtask.estimatedComplexity,
          lessonsLearned: [],
          verificationEvidence: [],
        } satisfies Task
    
        if (!seqOrderToTasks.has(subtask.sequenceOrder)) {
          seqOrderToTasks.set(subtask.sequenceOrder, new Array<Task>())
        }
    
        seqOrderToTasks.get(subtask.sequenceOrder)!.push(newTask)
      }
    
      const sortedSeqOrders = Array.from(seqOrderToTasks.keys()).sort((a, b) => a - b)
    
      for (let i = 1; i < sortedSeqOrders.length; i++) {
        const currentSeqOrder = sortedSeqOrders[i]
        const prevSeqOrder = sortedSeqOrders[i - 1]
    
        const currentOrderTasks = seqOrderToTasks.get(currentSeqOrder)!
        const previousOrderTasks = seqOrderToTasks.get(prevSeqOrder)!
    
        for (const currentOrderTask of currentOrderTasks) {
          currentOrderTask.dependsOnTaskIDs = previousOrderTasks.map((task) => task.taskID)
        }
      }
    
      const createdTasks = Array.from(seqOrderToTasks.values()).flat()
      for (const task of createdTasks) {
        taskDB.set(task.taskID, task)
      }
    
      const highestSeqOrderTasks = seqOrderToTasks.get(sortedSeqOrders[sortedSeqOrders.length - 1])!
      parentTask.dependsOnTaskIDs = [...parentTask.dependsOnTaskIDs, ...highestSeqOrderTasks.map((task) => task.taskID)]
    
      const incompleteTaskIDs = taskDB.incompleteTasksInTree(taskID).map((t) => t.taskID)
    
      const res = {
        taskUpdated: toBasicTaskInfo(parentTask, false, false, false),
        tasksCreated: createdTasks.map((t) => toBasicTaskInfo(t, false, false, true)),
        incompleteTasksIdealOrder: singleAgent ? incompleteTaskIDs : undefined,
      }
    
      return {
        content: [
          createdTasks.some((t) => mustDecompose(t)) &&
            ({
              type: 'text',
              text: "Some tasks must be decomposed before execution, use 'decompose_task' tool",
              audience: ['assistant'],
            } satisfies TextContent),
        ].filter(Boolean),
    
        structuredContent: res,
      } satisfies CallToolResult
    }
  • Defines the Zod schemas for validating inputs to the decompose_task tool: SubtaskSchema (extended from SimpleTaskSchema with complexity and sequenceOrder) and DecomposeTaskArgsSchema (taskID, reason, subtasks array).
    const SubtaskSchema = SimpleTaskSchema.extend({
      estimatedComplexity: TaskComplexitySchema,
      sequenceOrder: z
        .number()
        .int()
        .min(1)
        .describe(
          'The sequence order of this subtask. Subtasks may use the same sequence order if they can be executed in parallel.'
        ),
    })
    
    export const DecomposeTaskArgsSchema = z.object({
      taskID: TaskIDSchema.describe('The task to decompose'),
      decompositionReason: z.string().min(1).describe('The reason for decomposing this task'),
      subtasks: SubtaskSchema.array().min(1).describe('Array of smaller, manageable subtasks to create'),
    })
  • Defines and exports the tool constant DECOMPOSE_TASK and the decomposeTaskTool object including name, title, description, and JSON schema for MCP tool registration.
    export const DECOMPOSE_TASK = 'decompose_task'
    
    export const decomposeTaskTool = {
      name: DECOMPOSE_TASK,
      title: 'Decompose task',
      description: `Decomposes an existing complex task into smaller, more manageable subtasks.
    All tasks with complexity higher than low must always be decomposed before execution.
    Tasks MUST be in todo status to be decomposed.
    Subtasks with the same sequence order may be executed in parallel.
    Subtasks should include a verification subtask.
    Created subtasks may be decomposed later if needed.`,
      inputSchema: zodToJsonSchema(DecomposeTaskArgsSchema, { $refStrategy: 'none' }),
    }
  • tools/index.ts:29-32 (registration)
    Registers the decompose_task tool by mapping the tool name to its handler function and input schema in the central toolHandlers record.
    [DECOMPOSE_TASK]: {
      handler: handleDecomposeTask,
      schema: DecomposeTaskArgsSchema,
    } satisfies ToolHandlerInfo,
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes key behavioral traits: the tool creates subtasks (implying mutation), specifies prerequisites (complexity > low, todo status), explains parallel execution logic ('Subtasks with the same sequence order may be executed in parallel'), and notes recursion ('Created subtasks may be decomposed later if needed'). It lacks details on permissions or error handling, but covers substantial operational context.

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 front-loaded with the core purpose in the first sentence, followed by essential guidelines and behavioral notes in concise, bullet-like statements. Every sentence earns its place by providing critical operational rules without redundancy or fluff, making it highly efficient for an agent to parse.

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

Completeness4/5

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

Given the tool's complexity (mutation with multiple behavioral rules) and lack of annotations or output schema, the description does a strong job covering usage context, prerequisites, and behavioral traits. It explains the decomposition logic, parallel execution, and recursion, though it doesn't detail the response format or error scenarios, leaving minor gaps for a mutation tool.

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 already documents all three parameters thoroughly. The description adds no specific parameter semantics beyond what the schema provides (e.g., it doesn't clarify format or constraints for taskID, decompositionReason, or subtasks). The baseline score of 3 reflects adequate coverage by the schema alone.

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?

The description clearly states the specific action ('Decomposes an existing complex task') and resource ('into smaller, more manageable subtasks'), distinguishing it from sibling tools like create_task, update_task, or task_info which handle different task operations. The verb 'decomposes' precisely indicates breaking down rather than creating or modifying.

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

Usage Guidelines5/5

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

The description provides explicit when-to-use criteria: 'All tasks with complexity higher than low must always be decomposed before execution' and 'Tasks MUST be in todo status to be decomposed.' It also implies alternatives by specifying prerequisites, guiding the agent away from using this tool for simple tasks or tasks not in todo status.

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/blizzy78/mcp-task-manager'

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