Skip to main content
Glama

split_tasks

Split complex tasks into manageable subtasks with defined dependencies, priorities, and structured updates. Ideal for streamlining workflows and adapting plans dynamically.

Instructions

Decompose complex tasks into independent subtasks, establishing dependencies and priorities.

updateMode

  • append: Keep existing tasks and add new ones

  • overwrite: Delete unfinished tasks, keep completed ones

  • selective: Intelligently match and update existing tasks based on name

  • clearAllTasks: Clear all tasks and create a backup (preferred mode)

Key Requirements

  • Provide concise pseudocode: Only provide high-level logic flow and key steps, avoid complete code

  • Consolidate when necessary: Simple modifications can be integrated with other tasks to avoid excessive task count

  • Submit in batches: If there are too many tasks, use the "split_tasks" tool with parameters not exceeding 5000 characters

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
globalAnalysisResultNoGlobal analysis result: complete analysis result from reflect_task, applicable to the common parts of all tasks
tasksYesStructured task list, each task should be atomic and have a clear completion standard, avoid overly simple tasks, simple modifications can be integrated with other tasks, avoid too many tasks
updateModeYesTask update mode selection: 'append' (preserve all existing tasks and add new tasks), 'overwrite' (clear all unfinished tasks and completely replace, preserve completed tasks), 'selective' (intelligent update: match and update existing tasks by name, preserve tasks not in the list, recommended for minor task adjustments), 'clearAllTasks' (clear all tasks and create a backup). Default is 'clearAllTasks' mode, only use other modes when the user requests changes or modifications to the plan content

Implementation Reference

  • Main execution logic for the split_tasks tool. Validates input, checks for duplicate task names, processes tasks according to updateMode (clearAllTasks, append, overwrite, selective), calls batchCreateOrUpdateTasks from taskModel, generates a prompt with getSplitTasksPrompt, and returns structured content with ephemeral task creation results.
    export async function splitTasks({
      updateMode,
      tasks,
      globalAnalysisResult,
    }: z.infer<typeof splitTasksSchema>) {
      try {
        // Check if there are duplicate names in the tasks
        const nameSet = new Set();
        for (const task of tasks) {
          if (nameSet.has(task.name)) {
            return {
              content: [
                {
                  type: "text" as const,
                  text: "Duplicate task names exist in the tasks parameter, please ensure that each task name is unique",
                },
              ],
            };
          }
          nameSet.add(task.name);
        }
    
        // Process tasks based on different update modes
        let message = "";
        let actionSuccess = true;
        let backupFile = null;
        let createdTasks: Task[] = [];
        let allTasks: Task[] = [];
    
        // Convert task data to the format required for batchCreateOrUpdateTasks
        const convertedTasks = tasks.map((task) => ({
          name: task.name,
          description: task.description,
          notes: task.notes,
          dependencies: task.dependencies,
          implementationGuide: task.implementationGuide,
          verificationCriteria: task.verificationCriteria,
          relatedFiles: task.relatedFiles?.map((file) => ({
            path: file.path,
            type: file.type as RelatedFileType,
            description: file.description,
            lineStart: file.lineStart,
            lineEnd: file.lineEnd,
          })),
        }));
    
        // Process clearAllTasks mode
        if (updateMode === "clearAllTasks") {
          const clearResult = await modelClearAllTasks();
    
          if (clearResult.success) {
            message = clearResult.message;
            backupFile = clearResult.backupFile;
    
            try {
              // Clear tasks and then create new tasks
              createdTasks = await batchCreateOrUpdateTasks(
                convertedTasks,
                "append",
                globalAnalysisResult
              );
              message += `\nSuccessfully created ${createdTasks.length} new tasks.`;
            } catch (error) {
              actionSuccess = false;
              message += `\nError occurred when creating new tasks: ${
                error instanceof Error ? error.message : String(error)
              }`;
            }
          } else {
            actionSuccess = false;
            message = clearResult.message;
          }
        } else {
          // For other modes, directly use batchCreateOrUpdateTasks
          try {
            createdTasks = await batchCreateOrUpdateTasks(
              convertedTasks,
              updateMode,
              globalAnalysisResult
            );
    
            // Generate messages based on different update modes
            switch (updateMode) {
              case "append":
                message = `Successfully appended ${createdTasks.length} new tasks.`;
                break;
              case "overwrite":
                message = `Successfully cleared unfinished tasks and created ${createdTasks.length} new tasks.`;
                break;
              case "selective":
                message = `Successfully selectively updated/created ${createdTasks.length} tasks.`;
                break;
            }
          } catch (error) {
            actionSuccess = false;
            message = `Task creation failed: ${
              error instanceof Error ? error.message : String(error)
            }`;
          }
        }
    
        // Get all tasks for displaying dependency relationships
        try {
          allTasks = await getAllTasks();
        } catch (error) {
          allTasks = [...createdTasks]; // If retrieval fails, use just created tasks
        }
    
        // Use prompt generator to get the final prompt
        const prompt = getSplitTasksPrompt({
          updateMode,
          createdTasks,
          allTasks,
        });
    
        return {
          content: [
            {
              type: "text" as const,
              text: prompt,
            },
          ],
          ephemeral: {
            taskCreationResult: {
              success: actionSuccess,
              message,
              backupFilePath: backupFile,
            },
          },
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text" as const,
              text:
                "Error occurred when executing task splitting: " +
                (error instanceof Error ? error.message : String(error)),
            },
          ],
        };
      }
    }
  • Zod schema defining the input structure for split_tasks tool, including updateMode enum, array of tasks with name, description, implementationGuide, dependencies, notes, relatedFiles, verificationCriteria, and optional globalAnalysisResult. Used for validation in index.ts.
    export const splitTasksSchema = z.object({
      updateMode: z
        .enum(["append", "overwrite", "selective", "clearAllTasks"])
        .describe(
          "Task update mode selection: 'append' (preserve all existing tasks and add new tasks), 'overwrite' (clear all unfinished tasks and completely replace, preserve completed tasks), 'selective' (intelligent update: match and update existing tasks by name, preserve tasks not in the list, recommended for minor task adjustments), 'clearAllTasks' (clear all tasks and create a backup).\nDefault is 'clearAllTasks' mode, only use other modes when the user requests changes or modifications to the plan content"
        ),
      tasks: z
        .array(
          z.object({
            name: z
              .string()
              .max(100, {
                message: "Task name too long, please limit to 100 characters",
              })
              .describe("Brief and clear task name, should be able to express the purpose of the task"),
            description: z
              .string()
              .min(10, {
                message: "Task description too short, please provide more detailed content to ensure understanding",
              })
              .describe("Detailed task description, including implementation points, technical details and acceptance standards"),
            implementationGuide: z
              .string()
              .describe(
                "Specific implementation method and steps for this task, please refer to previous analysis results and provide simplified pseudocode"
              ),
            dependencies: z
              .array(z.string())
              .optional()
              .describe(
                "List of previous task IDs or task names this task depends on, supports two referencing methods, name referencing is more intuitive, and is a string array"
              ),
            notes: z
              .string()
              .optional()
              .describe("Supplementary notes, special processing requirements or implementation suggestions (optional)"),
            relatedFiles: z
              .array(
                z.object({
                  path: z
                    .string()
                    .min(1, {
                      message: "File path cannot be empty",
                    })
                    .describe("File path, can be a path relative to the project root directory or an absolute path"),
                  type: z
                    .nativeEnum(RelatedFileType)
                    .describe(
                      "File type (TO_MODIFY: to be modified, REFERENCE: reference material, CREATE: to be created, DEPENDENCY: dependency file, OTHER: other)"
                    ),
                  description: z
                    .string()
                    .min(1, {
                      message: "File description cannot be empty",
                    })
                    .describe("File description, used to explain the purpose and content of the file"),
                  lineStart: z
                    .number()
                    .int()
                    .positive()
                    .optional()
                    .describe("Starting line of the relevant code block (optional)"),
                  lineEnd: z
                    .number()
                    .int()
                    .positive()
                    .optional()
                    .describe("Ending line of the relevant code block (optional)"),
                })
              )
              .optional()
              .describe(
                "List of files related to the task, used to record code files, reference materials, files to be created, etc. related to the task (optional)"
              ),
            verificationCriteria: z
              .string()
              .optional()
              .describe("Verification criteria and inspection methods for this specific task"),
          })
        )
        .min(1, {
          message: "Please provide at least one task",
        })
        .describe(
          "Structured task list, each task should be atomic and have a clear completion standard, avoid overly simple tasks, simple modifications can be integrated with other tasks, avoid too many tasks"
        ),
      globalAnalysisResult: z
        .string()
        .optional()
        .describe("Global analysis result: complete analysis result from reflect_task, applicable to the common parts of all tasks"),
    });
  • src/index.ts:420-431 (registration)
    Dispatch logic in CallToolRequestSchema handler: parses arguments with splitTasksSchema and calls splitTasks handler function.
    case "split_tasks":
      parsedArgs = await splitTasksSchema.safeParseAsync(
        request.params.arguments
      );
      if (!parsedArgs.success) {
        throw new Error(
          `Invalid arguments for tool ${request.params.name}: ${parsedArgs.error.message}`
        );
      }
      result = await splitTasks(parsedArgs.data);
      return result;
  • src/index.ts:249-254 (registration)
    Tool registration in ListToolsRequestSchema handler: defines name 'split_tasks', loads description from markdown template, converts splitTasksSchema to JSON schema for MCP protocol.
      name: "split_tasks",
      description: loadPromptFromTemplate(
        "toolsDescription/splitTasks.md"
      ),
      inputSchema: zodToJsonSchema(splitTasksSchema),
    },
  • Prompt generator function getSplitTasksPrompt used by the handler to format the response prompt showing created/updated tasks and dependencies.
    export function getSplitTasksPrompt(params: SplitTasksPromptParams): string {
Behavior4/5

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

With no annotations provided, the description carries full burden and does well by disclosing key behavioral traits: it explains the four update modes with their effects (e.g., 'overwrite' deletes unfinished tasks), mentions batch submission limits (5000 characters), and provides implementation guidelines like consolidating tasks. However, it doesn't cover error handling or performance characteristics.

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 well-structured with clear sections (updateMode, Key Requirements) and front-loaded purpose. However, some sentences could be more concise (e.g., the updateMode descriptions are somewhat verbose), and the pseudocode requirement is repeated. Overall efficient but with minor redundancy.

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?

For a complex tool with 3 parameters, no annotations, and no output schema, the description provides good context: it covers usage scenarios, behavioral details, and constraints. However, it lacks information on return values or error cases, which would be helpful given the absence of output schema. It's mostly complete but has minor gaps.

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 parameters thoroughly. The description adds minimal value beyond the schema: it briefly mentions updateMode options but doesn't provide additional context about tasks or globalAnalysisResult parameters. 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.

Purpose5/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 with specific verbs ('decompose complex tasks') and resources ('into independent subtasks'), and distinguishes it from siblings by focusing on task decomposition rather than analysis, execution, or querying. It goes beyond the tool name to explain the core function.

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 guidance on when to use this tool vs alternatives: it specifies 'Submit in batches' if tasks exceed character limits, and the updateMode section details when to use each mode (e.g., 'clearAllTasks' is preferred, other modes for user-requested changes). This gives clear context for tool selection.

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/liorfranko/mcp-chain-of-thought'

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