subtask_update
Modify subtask details including title, status, or order in project tracking systems to maintain accurate task management and progress monitoring.
Instructions
Update a subtask title, status, or sort order.
Input Schema
TableJSON 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)The handleSubtaskUpdate function implements the business logic for updating a subtask, including input validation, database execution, and logging activity.
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)The schema definition for the 'subtask_update' tool.
{ 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 map linking tool names to their respective handler functions.
export const handlers: Record<string, ToolHandler> = { subtask_create: handleSubtaskCreate, subtask_update: handleSubtaskUpdate, subtask_delete: handleSubtaskDelete, };