subtask_create
Add checklist items to tasks in Saga MCP's project tracker. Create single or multiple subtasks to organize work and track progress within structured projects.
Instructions
Create one or more subtasks (checklist items) for a task. Accepts a single title string or an array of title strings for batch creation.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| task_id | Yes | Parent task ID | |
| titles | Yes |
Implementation Reference
- src/tools/subtasks.ts:60-79 (handler)The handler function `handleSubtaskCreate` executes the logic for creating subtasks in the database.
function handleSubtaskCreate(args: Record<string, unknown>) { const db = getDb(); const taskId = args.task_id as number; const rawTitles = args.titles; const titles = Array.isArray(rawTitles) ? rawTitles as string[] : [rawTitles as string]; const stmt = db.prepare( 'INSERT INTO subtasks (task_id, title) VALUES (?, ?) RETURNING *' ); const created = db.transaction(() => { return titles.map((title) => { const subtask = stmt.get(taskId, title) as Record<string, unknown>; logActivity(db, 'subtask', subtask.id as number, 'created', null, null, null, `Subtask '${title}' created`); return subtask; }); })(); return created.length === 1 ? created[0] : created; } - src/tools/subtasks.ts:6-25 (schema)The tool definition for `subtask_create` including its input schema and description.
export const definitions: Tool[] = [ { name: 'subtask_create', description: 'Create one or more subtasks (checklist items) for a task. Accepts a single title string or an array of title strings for batch creation.', annotations: { title: 'Create Subtask(s)', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false }, inputSchema: { type: 'object', properties: { task_id: { type: 'integer', description: 'Parent task ID' }, titles: { oneOf: [ { type: 'string', description: 'Single subtask title' }, { type: 'array', items: { type: 'string' }, description: 'Multiple subtask titles' }, ], }, }, required: ['task_id', 'titles'], }, }, - src/tools/subtasks.ts:145-149 (registration)The `handlers` object maps the tool name `subtask_create` to its implementation function `handleSubtaskCreate`.
export const handlers: Record<string, ToolHandler> = { subtask_create: handleSubtaskCreate, subtask_update: handleSubtaskUpdate, subtask_delete: handleSubtaskDelete, };