Skip to main content
Glama

plan_tasks

Generate and organize multiple tasks from a structured plan, assign IDs, prioritize, add deadlines, tags, and dependencies, and sync with a knowledge graph for efficient task management.

Instructions

Create multiple tasks from a plan. Generates IDs and syncs with knowledge graph.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tasksYesList of tasks to create with their details

Implementation Reference

  • The execute handler for plan_tasks tool. Parses input parameters using PlanTasksSchema, iterates over tasks to create them via taskStorage.add(), handles errors per task, and returns list of created tasks.
    execute: async (params: any) => {
      try {
        // Validate input parameters
        const validatedParams = PlanTasksSchema.parse(params);
        const createdTasks = [];
        
        for (const task of validatedParams.tasks) {
          try {
            const newTask = taskStorage.add({
              description: task.description,
              status: task.status || "todo",
              priority: task.priority || "medium",
              due: task.due,
              tags: task.tags || [],
              dependsOn: task.dependsOn || []
            });
            createdTasks.push(newTask);
          } catch (error) {
            return JSON.stringify({ 
              error: `Failed to create task: ${error instanceof Error ? error.message : String(error)}`,
              task: task
            });
          }
        }
        
        return JSON.stringify({ 
          tasks: createdTasks,
          message: `Created ${createdTasks.length} tasks`
        });
      } catch (error) {
        return JSON.stringify({ 
          error: `Invalid task parameters: ${error instanceof Error ? error.message : String(error)}`
        });
      }
    }
  • Zod schema PlanTasksSchema defining the input parameters for plan_tasks: an array of task objects with required description and optional status, dependsOn, due, priority, tags.
    // Schema for plan_tasks parameters
    const PlanTasksSchema = z.object({
      tasks: z.array(
        z.object({
          description: z.string().min(3, "Description must be at least 3 characters"),
          status: TaskStatusEnum.optional(),
          dependsOn: z.array(z.string().uuid()).optional(),
          due: z.string().datetime().optional(),
          priority: TaskPriorityEnum.optional(),
          tags: z.array(z.string()).optional()
        })
      )
    });
  • Registers the plan_tasks tool on the FastMCP server instance using server.addTool(), providing name, description, and the execute handler.
    server.addTool({
      name: "plan_tasks",
      description: "Create multiple tasks from a plan. Generates IDs and syncs with knowledge graph.",
      execute: async (params: any) => {
        try {
          // Validate input parameters
          const validatedParams = PlanTasksSchema.parse(params);
          const createdTasks = [];
          
          for (const task of validatedParams.tasks) {
            try {
              const newTask = taskStorage.add({
                description: task.description,
                status: task.status || "todo",
                priority: task.priority || "medium",
                due: task.due,
                tags: task.tags || [],
                dependsOn: task.dependsOn || []
              });
              createdTasks.push(newTask);
            } catch (error) {
              return JSON.stringify({ 
                error: `Failed to create task: ${error instanceof Error ? error.message : String(error)}`,
                task: task
              });
            }
          }
          
          return JSON.stringify({ 
            tasks: createdTasks,
            message: `Created ${createdTasks.length} tasks`
          });
        } catch (error) {
          return JSON.stringify({ 
            error: `Invalid task parameters: ${error instanceof Error ? error.message : String(error)}`
          });
        }
      }
    });

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/flight505/mcp-think-tank'

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