update_task
Modify task details like status, title, description, or priority using the DUID for precise updates within the Dart MCP Server.
Instructions
Update an existing task
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| description | No | New description for the task | |
| duid | Yes | DUID of the task to update | |
| priority | No | New priority for the task | |
| status_duid | No | New status DUID | |
| title | No | New title for the task |
Implementation Reference
- src/index.ts:597-661 (handler)Executes the update_task tool by constructing and running embedded Python code that uses the Dart SDK to update a task with the provided parameters (duid required, others optional).case 'update_task': { console.error('[Debug] Handling update_task request'); const command = `print("[Debug] Starting task update", file=sys.stderr) try: # Get initialized client and bundle client, bundle, dartboard_duid = initialize() print("[Debug] Got client and bundle", file=sys.stderr) print("[Debug] Creating task update object", file=sys.stderr) task_update = TaskUpdate( duid="${args.duid}", source_type=UNSET ) if ${args.status_duid !== undefined ? 'True' : 'False'}: task_update.status_duid = "${args.status_duid}" if ${args.title !== undefined ? 'True' : 'False'}: task_update.title = "${args.title}" if ${args.description !== undefined ? 'True' : 'False'}: task_update.description = "${args.description}" if ${args.priority !== undefined ? 'True' : 'False'}: task_update.priority = "${args.priority}" print("[Debug] Task update object created:", task_update, file=sys.stderr) print("[Debug] Creating operation", file=sys.stderr) task_update_op = Operation( model=OperationModelKind.TASK, kind=OperationKind.UPDATE, data=task_update ) print("[Debug] Operation created:", task_update_op, file=sys.stderr) print("[Debug] Executing transaction", file=sys.stderr) response = client.transact([task_update_op], TransactionKind.TASK_UPDATE) print("[Debug] Transaction completed", file=sys.stderr) if response.results and response.results[0].success: print(f"Task updated successfully") print(f"[Debug] Task update successful", file=sys.stderr) else: print("[Debug] Task update failed", file=sys.stderr) if response.results: print(f"[Debug] Result: {response.results[0]}", file=sys.stderr) print("Failed to update task", file=sys.stderr) sys.exit(1) except Exception as e: print(f"[Debug] Task update error: {str(e)}", file=sys.stderr) print("[Debug] Error type:", type(e), file=sys.stderr) traceback.print_exc(file=sys.stderr) sys.exit(1)`; console.error('[Debug] Running Python command for task update'); const output = await this.runDartCommand(command); console.error('[Debug] Task update output:', output); const response = { content: [{ type: 'text', text: output, }], }; console.error('[Debug] Sending task update response:', JSON.stringify(response, null, 2)); return response; }
- src/index.ts:304-330 (schema)Defines the input schema for the update_task tool, specifying required 'duid' and optional fields for status, title, description, and priority.inputSchema: { type: 'object', properties: { duid: { type: 'string', description: 'DUID of the task to update', }, status_duid: { type: 'string', description: 'New status DUID', }, title: { type: 'string', description: 'New title for the task', }, description: { type: 'string', description: 'New description for the task', }, priority: { type: 'string', description: 'New priority for the task', enum: ['Low', 'Medium', 'High', 'Critical'], } }, required: ['duid'], },
- src/index.ts:302-331 (registration)Registers the update_task tool in the listTools response, including its name, description, and input schema.name: 'update_task', description: 'Update an existing task', inputSchema: { type: 'object', properties: { duid: { type: 'string', description: 'DUID of the task to update', }, status_duid: { type: 'string', description: 'New status DUID', }, title: { type: 'string', description: 'New title for the task', }, description: { type: 'string', description: 'New description for the task', }, priority: { type: 'string', description: 'New priority for the task', enum: ['Low', 'Medium', 'High', 'Critical'], } }, required: ['duid'], }, },
- src/index.ts:123-227 (helper)Helper function used by all tools, including update_task, to execute dynamically generated Python code that interacts with the Dart library via child_process.spawn.async runDartCommand(args) { return new Promise((resolve, reject) => { // Use pyenv Python const pythonPath = '/Users/speed/.pyenv/shims/python'; console.error('[Debug] Running Python command with:', pythonPath); const command = `import sys import os import traceback import json from dart import Dart, Operation, OperationKind, OperationModelKind, TaskCreate, TaskUpdate, TransactionKind, TaskSourceType, SpaceCreate from dart.generated.types import UNSET from dart.dart import _Session, UserBundle, _make_duid from dart.generated.models.icon_kind import IconKind from dart.generated.models.sprint_mode import SprintMode from dart.generated.models.validation_error_response import ValidationErrorResponse def initialize(): print("[Debug] Starting Python execution", file=sys.stderr) print("[Debug] Current directory:", os.getcwd(), file=sys.stderr) print("[Debug] PYTHONPATH:", os.environ.get('PYTHONPATH'), file=sys.stderr) print("[Debug] DART_TOKEN:", os.environ.get('DART_TOKEN'), file=sys.stderr) session = _Session() print("[Debug] Session created", file=sys.stderr) bundle = UserBundle(session) print("[Debug] UserBundle created", file=sys.stderr) dartboard_duid = bundle.default_dartboard["duid"] print(f"[Debug] Got dartboard DUID: {dartboard_duid}", file=sys.stderr) client = Dart() print("[Debug] Dart client created", file=sys.stderr) return client, bundle, dartboard_duid def run_command(client, bundle, dartboard_duid): ${args} def main(): client, bundle, dartboard_duid = initialize() run_command(client, bundle, dartboard_duid) try: main() except Exception as e: print(f"Error: {str(e)}", file=sys.stderr) traceback.print_exc(file=sys.stderr) sys.exit(1)`; console.error('[Debug] Python command:', command); // Create a clean environment without virtual env variables const env = { ...process.env }; delete env.VIRTUAL_ENV; delete env.CONDA_PREFIX; delete env.CONDA_DEFAULT_ENV; delete env.CONDA_PYTHON_EXE; const childProcess = spawn(pythonPath, ['-c', command], { env: { ...env, PYTHONUNBUFFERED: '1', PYTHONPATH: process.env.PYTHONPATH || process.cwd(), DART_TOKEN: process.env.DART_TOKEN, }, stdio: ['pipe', 'pipe', 'pipe'], }); let output = ''; let errorOutput = ''; childProcess.stdout?.on('data', (data) => { const str = data.toString(); console.error('[Debug] Python stdout:', str); output += str; }); childProcess.stderr?.on('data', (data) => { const str = data.toString(); console.error('[Debug] Python stderr:', str); errorOutput += str; }); childProcess.on('error', (error) => { console.error('[Debug] Python process error:', error); reject(new Error(`Failed to start Python process: ${error.message}`)); }); // Add timeout const timeout = setTimeout(() => { console.error('[Debug] Python command timed out'); childProcess.kill(); reject(new Error('Command timed out')); }, 30000); // 30 second timeout childProcess.on('close', (code) => { clearTimeout(timeout); console.error(`[Debug] Python process exited with code ${code}`); if (code === 0) { resolve(output.trim()); } else { reject(new Error(errorOutput || `Command failed with exit code ${code}`)); } }); }); }