subtask_update
Update a subtask's title, status, or sort order to maintain task hierarchy in project tracking.
Instructions
Update a subtask title, status, or sort order.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Subtask ID | |
| title | No | ||
| status | No | ||
| sort_order | No |
Implementation Reference
- src/tools/subtasks.ts:81-122 (handler)Handler function that executes subtask update logic: fetches current subtask, builds dynamic UPDATE query for title/status/sort_order, logs status changes, and returns updated row.
function handleSubtaskUpdate(args: Record<string, unknown>) { const db = getDb(); const id = args.id as number; const oldRow = db.prepare('SELECT * FROM subtasks WHERE id = ?').get(id) as Record<string, unknown> | undefined; if (!oldRow) throw new Error(`Subtask ${id} not found`); const updates: string[] = []; const params: unknown[] = []; if (args.title !== undefined) { updates.push('title = ?'); params.push(args.title); } if (args.status !== undefined) { updates.push('status = ?'); params.push(args.status); } if (args.sort_order !== undefined) { updates.push('sort_order = ?'); params.push(args.sort_order); } if (updates.length === 0) throw new Error('No fields to update'); updates.push("updated_at = datetime('now')"); params.push(id); const newRow = db .prepare(`UPDATE subtasks SET ${updates.join(', ')} WHERE id = ? RETURNING *`) .get(...params) as Record<string, unknown>; if (oldRow.status !== newRow.status) { logActivity( db, 'subtask', id, 'status_changed', 'status', oldRow.status as string, newRow.status as string, `Subtask '${newRow.title}' status: ${oldRow.status} -> ${newRow.status}` ); } return newRow; } - src/tools/subtasks.ts:26-40 (schema)Input schema definition for subtask_update tool, defining properties id (required), title, status (enum), and sort_order.
{ name: 'subtask_update', description: 'Update a subtask title, status, or sort order.', annotations: { title: 'Update Subtask', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false }, inputSchema: { type: 'object', properties: { id: { type: 'integer', description: 'Subtask ID' }, title: { type: 'string' }, status: { type: 'string', enum: ['todo', 'in_progress', 'done'] }, sort_order: { type: 'integer' }, }, required: ['id'], }, }, - src/tools/subtasks.ts:145-149 (registration)Registration mapping the tool name 'subtask_update' to the handleSubtaskUpdate handler function.
export const handlers: Record<string, ToolHandler> = { subtask_create: handleSubtaskCreate, subtask_update: handleSubtaskUpdate, subtask_delete: handleSubtaskDelete, };