update_task
Modify an existing pending task by updating its description or dependencies to reflect changes in task orchestration workflows.
Instructions
Update an existing pending task
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"task_id": "<task_id>"
},
"name": "update_task"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| task_id | Yes | ID of the task to update | |
| description | No | New description for the task | |
| dependencies | No | New list of dependency task IDs |
Implementation Reference
- src/index.ts:131-182 (handler)Executes the update_task tool: updates pending task's description or dependencies, validates task existence, status, dependency existence, and absence of cycles. Persists changes to tasks.json and returns updated task.
case "update_task": { const { task_id, description, dependencies } = request.params.arguments as { task_id: string; description?: string; dependencies?: string[]; }; debug(`Updating task ${task_id}`); const task = tasks[task_id]; if (!task) { throw new McpError(ErrorCode.InvalidRequest, `Task ${task_id} not found`); } if (task.status !== 'pending') { throw new McpError(ErrorCode.InvalidRequest, `Cannot update task ${task_id} in ${task.status} state`); } // Verify dependencies exist and don't create cycles if (dependencies) { const visited = new Set<string>(); const checkCycle = (taskId: string): boolean => { if (visited.has(taskId)) return true; visited.add(taskId); return (tasks[taskId]?.dependencies || []).some(depId => checkCycle(depId)); }; for (const depId of dependencies) { if (!tasks[depId]) { throw new McpError(ErrorCode.InvalidRequest, `Dependency task ${depId} not found`); } if (depId === task_id || checkCycle(depId)) { throw new McpError(ErrorCode.InvalidRequest, `Dependencies would create a cycle`); } } task.dependencies = dependencies; } if (description) { task.description = description; } saveTasks(); debug(`Updated task ${task_id}`); return { content: [{ type: "text", text: JSON.stringify(task, null, 2) }] }; } - src/index.ts:363-387 (registration)Registers the update_task tool in the listTools response, providing name, description, and input schema for task_id (required), optional description and dependencies.
{ name: "update_task", description: "Update an existing pending task", inputSchema: { type: "object", properties: { task_id: { type: "string", description: "ID of the task to update" }, description: { type: "string", description: "New description for the task" }, dependencies: { type: "array", items: { type: "string" }, description: "New list of dependency task IDs" } }, required: ["task_id"] } }, - src/index.ts:366-386 (schema)Defines the input schema for update_task tool.
inputSchema: { type: "object", properties: { task_id: { type: "string", description: "ID of the task to update" }, description: { type: "string", description: "New description for the task" }, dependencies: { type: "array", items: { type: "string" }, description: "New list of dependency task IDs" } }, required: ["task_id"] }