create_task
Define and organize tasks with dependencies, completion criteria, and uncertainty areas. Essential for managing complex workflows and ensuring clarity before execution.
Instructions
A tool to create a new task that must be completed. Can optionally provide a list of tasks that must be completed first. Should provide a list of uncertainty areas to clarify before starting this task. All tasks start in the 'not-started' status. Use the 'transition_task_status' tool to transition the status of this task.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| definitionsOfDone | Yes | A detailed list of criteria that must be met for this task to be considered complete. | |
| dependsOnTaskIDs | Yes | A list of task identifiers this task depends on. Must be provided if these tasks must be complete before this task can be started. | |
| description | Yes | A detailed description of this task. | |
| goal | Yes | The overall goal of this task. | |
| title | Yes | A concise title for this task. | |
| uncertaintyAreas | Yes | A detailed list of areas where there is uncertainty about this task's requirements or execution. May be empty. Ensure list is ordered by priority. |
Implementation Reference
- tools/create_task.ts:33-90 (handler)The core handler function `handleCreateTask` that implements the logic for creating a new task: generates ID, sets properties, stores in taskDB, handles single-agent current task, computes incomplete tasks, and returns MCP CallToolResult with text warnings if needed and resource link to the new task.export async function handleCreateTask( { title, description, goal, definitionsOfDone, criticalPath, uncertaintyAreas, estimatedComplexity }: CreateTaskArgs, taskDB: TaskDB, singleAgent: boolean ) { const task = { taskID: newTaskID(), status: TodoStatus, dependsOnTaskIDs: [], title, description, goal, definitionsOfDone, criticalPath: !!criticalPath, uncertaintyAreas, estimatedComplexity, lessonsLearned: [], verificationEvidence: [], } satisfies Task taskDB.set(task.taskID, task) if (singleAgent) { taskDB.setCurrentTask(task.taskID) } const incompleteTaskIDs = taskDB.incompleteTasksInTree(task.taskID).map((t) => t.taskID) const res = { taskCreated: toBasicTaskInfo(task, false, false, true), incompleteTasksIdealOrder: singleAgent ? incompleteTaskIDs : undefined, } return { content: [ mustDecompose(task) && ({ type: 'text', text: "Task must be decomposed before execution, use 'decompose_task' tool", audience: ['assistant'], } satisfies TextContent), { type: 'resource_link', uri: `task://${task.taskID}`, name: task.taskID, title: task.title, annotations: { audience: ['assistant'], priority: 1, }, } satisfies ResourceLink, ].filter(Boolean), structuredContent: res, } satisfies CallToolResult }
- tools/create_task.ts:15-19 (schema)Zod schema defining input parameters for the create_task tool, extending SimpleTaskSchema with estimatedComplexity.export const CreateTaskArgsSchema = SimpleTaskSchema.extend({ estimatedComplexity: TaskComplexitySchema, }) type CreateTaskArgs = z.infer<typeof CreateTaskArgsSchema>
- tools/index.ts:24-27 (registration)Registration of the create_task tool in the toolHandlers map, mapping the tool name to its handler function and input schema.[CREATE_TASK]: { handler: handleCreateTask, schema: CreateTaskArgsSchema, } satisfies ToolHandlerInfo,
- tools/create_task.ts:23-30 (registration)The MCP tool object definition `createTaskTool` providing name, title, description, and JSON input schema for protocol registration.export const createTaskTool = { name: CREATE_TASK, title: 'Create task', description: `Creates a new task that must be executed. If decomposing a complex task is required, must use 'decompose_task' first before executing it. All tasks start in the todo status. Must use 'update_task' before executing this task, and when executing this task has finished.`, inputSchema: zodToJsonSchema(CreateTaskArgsSchema, { $refStrategy: 'none' }),
- tools/index.ts:16-16 (registration)Inclusion of createTaskTool in the array of available tools returned by tools() function (for non-single-agent mode).return [createTaskTool, decomposeTaskTool, updateTaskTool, taskInfoTool] as const