task_get
Retrieve a complete task record with all subtasks, notes, comments, and dependencies for detailed project tracking in structured databases.
Instructions
Get a single task with full details including all subtasks, related notes, comments, and dependencies.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Task ID |
Implementation Reference
- src/tools/tasks.ts:283-340 (handler)The handler function that executes the logic for fetching a task and its related data (subtasks, notes, comments, dependencies).
function handleTaskGet(args: Record<string, unknown>) { const db = getDb(); const id = args.id as number; const task = db .prepare( `SELECT t.*, e.name as epic_name FROM tasks t JOIN epics e ON e.id = t.epic_id WHERE t.id = ?` ) .get(id); if (!task) throw new Error(`Task ${id} not found`); const subtasks = db .prepare('SELECT * FROM subtasks WHERE task_id = ? ORDER BY sort_order, created_at') .all(id); const notes = db .prepare( `SELECT * FROM notes WHERE related_entity_type = 'task' AND related_entity_id = ? ORDER BY created_at DESC` ) .all(id); const comments = db .prepare('SELECT * FROM comments WHERE task_id = ? ORDER BY created_at ASC') .all(id); // Dependencies: what this task depends on const dependsOn = db .prepare( `SELECT t.id, t.title, t.status FROM task_dependencies d JOIN tasks t ON t.id = d.depends_on_task_id WHERE d.task_id = ?` ) .all(id); // Dependents: what tasks depend on this task const dependents = db .prepare( `SELECT t.id, t.title, t.status FROM task_dependencies d JOIN tasks t ON t.id = d.task_id WHERE d.depends_on_task_id = ?` ) .all(id); return { ...(task as object), subtasks, notes, comments, depends_on: dependsOn, dependents }; } function handleTaskUpdate(args: Record<string, unknown>) { const db = getDb(); const id = args.id as number; const oldRow = db.prepare('SELECT * FROM tasks WHERE id = ?').get(id) as Record<string, unknown> | undefined; if (!oldRow) throw new Error(`Task ${id} not found`); - src/tools/tasks.ts:77-83 (schema)The input schema definition for the task_get tool.
inputSchema: { type: 'object', properties: { id: { type: 'integer', description: 'Task ID' }, }, required: ['id'], }, - src/tools/tasks.ts:407-407 (registration)The registration of the task_get tool handler within the tool mapping.
task_get: handleTaskGet,