complete_task
Mark a task as completed in Taskwarrior by claiming it with an agent ID, then automatically releasing it after finishing the task to manage workflow efficiently.
Instructions
Mark a task as done. Auto-claims then releases after completion.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Task ID or UUID | |
| agent_id | Yes | Globally unique agent identifier (e.g. "claude-opus-<uuid>"). Each agent instance MUST use a distinct ID to prevent collisions between parallel agents. |
Implementation Reference
- src/taskwarrior.ts:136-144 (handler)The core logic that executes the 'done' command via Taskwarrior.
export async function completeTask(id: string, agentId: string): Promise<void> { const uuid = await ensureClaim(id, agentId); try { await runCommand('task', ['rc.confirmation=no', uuid, 'done']); } catch (err) { throw new Error(`Failed to complete task ${id}: ${(err as Error).message}`); } await releaseClaim(uuid); } - src/index.ts:176-191 (registration)The registration of the 'complete_task' tool in the MCP server.
server.tool( 'complete_task', 'Mark a task as done. Auto-claims then releases after completion.', { id: idParam, agent_id: agentIdParam, }, async ({ id, agent_id }) => { try { await completeTask(id, agent_id); return { content: [{ type: 'text', text: `Task ${id} completed.` }] }; } catch (err) { return { content: [{ type: 'text', text: (err as Error).message }], isError: true }; } }, );