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
| Name | Required | Description | Default |
|---|---|---|---|
| tasks | Yes | List of tasks to create with their details |
Implementation Reference
- src/tasks/tools.ts:56-90 (handler)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)}` }); } }
- src/tasks/tools.ts:12-24 (schema)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() }) ) });
- src/tasks/tools.ts:53-91 (registration)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)}` }); } } });