task_create
Create tasks within project epics to organize work units with details like priority, assignee, due dates, and dependencies in a structured project tracker.
Instructions
Create a task within an epic. Tasks are the primary unit of work.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| epic_id | Yes | Parent epic ID | |
| title | Yes | Task title | |
| description | No | Task description | |
| status | No | todo | |
| priority | No | medium | |
| assigned_to | No | Assignee name | |
| estimated_hours | No | Estimated hours | |
| due_date | No | Due date (YYYY-MM-DD) | |
| source_ref | No | Link to source code location | |
| depends_on | No | Task IDs this task depends on | |
| tags | No |
Implementation Reference
- src/tools/tasks.ts:174-207 (handler)The function `handleTaskCreate` which implements the logic for the `task_create` tool.
function handleTaskCreate(args: Record<string, unknown>) { const db = getDb(); const epicId = args.epic_id as number; const title = args.title as string; const description = (args.description as string) ?? null; const status = (args.status as string) ?? 'todo'; const priority = (args.priority as string) ?? 'medium'; const assignedTo = (args.assigned_to as string) ?? null; const estimatedHours = (args.estimated_hours as number) ?? null; const dueDate = (args.due_date as string) ?? null; const sourceRef = args.source_ref ? JSON.stringify(args.source_ref) : null; const tags = JSON.stringify((args.tags as string[]) ?? []); const dependsOn = (args.depends_on as number[]) ?? []; const task = db .prepare( `INSERT INTO tasks (epic_id, title, description, status, priority, assigned_to, estimated_hours, due_date, source_ref, tags) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING *` ) .get(epicId, title, description, status, priority, assignedTo, estimatedHours, dueDate, sourceRef, tags); const row = task as Record<string, unknown>; const taskId = row.id as number; logActivity(db, 'task', taskId, 'created', null, null, null, `Task '${title}' created`); if (dependsOn.length > 0) { setDependencies(db, taskId, dependsOn); evaluateAndUpdateDependencies(db, taskId); // Re-fetch to get potentially updated status return db.prepare('SELECT * FROM tasks WHERE id = ?').get(taskId); } return task; } - src/tools/tasks.ts:8-49 (schema)The MCP tool definition for `task_create` including the input schema.
export const definitions: Tool[] = [ { name: 'task_create', description: 'Create a task within an epic. Tasks are the primary unit of work.', annotations: { title: 'Create Task', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false }, inputSchema: { type: 'object', properties: { epic_id: { type: 'integer', description: 'Parent epic ID' }, title: { type: 'string', description: 'Task title' }, description: { type: 'string', description: 'Task description' }, status: { type: 'string', enum: ['todo', 'in_progress', 'review', 'done', 'blocked'], default: 'todo', }, priority: { type: 'string', enum: ['low', 'medium', 'high', 'critical'], default: 'medium', }, assigned_to: { type: 'string', description: 'Assignee name' }, estimated_hours: { type: 'number', description: 'Estimated hours' }, due_date: { type: 'string', description: 'Due date (YYYY-MM-DD)' }, source_ref: { type: 'object', description: 'Link to source code location', properties: { file: { type: 'string', description: 'File path' }, line_start: { type: 'integer', description: 'Start line number' }, line_end: { type: 'integer', description: 'End line number' }, repo: { type: 'string', description: 'Repository URL or name' }, commit: { type: 'string', description: 'Commit hash' }, }, required: ['file'], }, depends_on: { type: 'array', items: { type: 'integer' }, description: 'Task IDs this task depends on' }, tags: { type: 'array', items: { type: 'string' } }, }, required: ['epic_id', 'title'], }, }, - src/tools/tasks.ts:404-409 (registration)Registration of the `task_create` tool handler.
export const handlers: Record<string, ToolHandler> = { task_create: handleTaskCreate, task_list: handleTaskList, task_get: handleTaskGet, task_update: handleTaskUpdate, };