tb_add_task
Adds a task to a board, requiring a spec reference and acceptance criteria for traceable, spec-driven development.
Instructions
Add a task to an existing board. Every task should reference a spec and have acceptance criteria.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| board_id | Yes | Board ID | |
| title | Yes | Task title | |
| description | No | Task description | |
| priority | No | Priority: p0 (critical), p1 (high), p2 (medium), p3 (low) | p2 |
| spec_ref | No | Reference to spec document | |
| acceptance_criteria | No | Acceptance criteria for completion | |
| dependencies | No | Task IDs this task depends on |
Implementation Reference
- src/tools/task-board.ts:108-146 (handler)The tb_add_task tool handler: registers an MCP tool that adds a task to an existing board. Validates board existence, generates a task ID, inserts into the tasks table, and returns the created task details.
// ── Add Task ─────────────────────────────────────── server.tool( "tb_add_task", "Add a task to an existing board. Every task should reference a spec and have acceptance criteria.", { board_id: z.string().max(256).describe("Board ID"), title: z.string().min(3).max(512).describe("Task title"), description: z.string().max(65536).default("").describe("Task description"), priority: z.enum(TASK_PRIORITIES).default("p2").describe("Priority: p0 (critical), p1 (high), p2 (medium), p3 (low)"), spec_ref: z.string().max(512).optional().describe("Reference to spec document"), acceptance_criteria: z.string().max(65536).default("").describe("Acceptance criteria for completion"), dependencies: z.array(z.string()).default([]).describe("Task IDs this task depends on"), }, async ({ board_id, title, description, priority, spec_ref, acceptance_criteria, dependencies }) => { const db = getDb(); const board = db.prepare(`SELECT id FROM boards WHERE id = ?`).get(board_id); if (!board) { return { content: [{ type: "text" as const, text: JSON.stringify({ error: `Board ${board_id} not found` }) }], }; } const id = generateId("task"); db.prepare( `INSERT INTO tasks (id, board_id, title, description, priority, spec_ref, acceptance_criteria, dependencies) VALUES (?, ?, ?, ?, ?, ?, ?, ?)` ).run(id, board_id, title, description, priority, spec_ref || null, acceptance_criteria, JSON.stringify(dependencies)); return { content: [ { type: "text" as const, text: JSON.stringify({ created: true, task_id: id, board_id, title, priority }), }, ], }; } ); - src/tools/task-board.ts:112-120 (schema)Input schema for tb_add_task: defines board_id, title, description, priority, spec_ref, acceptance_criteria, and dependencies parameters with Zod validation.
{ board_id: z.string().max(256).describe("Board ID"), title: z.string().min(3).max(512).describe("Task title"), description: z.string().max(65536).default("").describe("Task description"), priority: z.enum(TASK_PRIORITIES).default("p2").describe("Priority: p0 (critical), p1 (high), p2 (medium), p3 (low)"), spec_ref: z.string().max(512).optional().describe("Reference to spec document"), acceptance_criteria: z.string().max(65536).default("").describe("Acceptance criteria for completion"), dependencies: z.array(z.string()).default([]).describe("Task IDs this task depends on"), }, - src/tools/task-board.ts:109-109 (registration)Registration of the tb_add_task tool via server.tool() on line 109, inside registerTaskBoardTools().
server.tool( - src/server.ts:18-20 (registration)registerTaskBoardTools(server) is called in createServer() which registers all task board tools including tb_add_task.
registerSddTools(server); registerTaskBoardTools(server); registerFileTools(server); - src/utils/id.ts:3-5 (helper)generateId helper used by tb_add_task to create unique task IDs with a 'task-' prefix.
export function generateId(prefix: string = ""): string { const uuid = randomUUID().replace(/-/g, ""); return prefix ? `${prefix}-${uuid}` : uuid;