update_task
Modify existing task details including title, status, and assigned user to manage workflow changes effectively.
Instructions
Update an existing task
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Task ID | |
| title | No | Task title | |
| status | No | Task status | |
| assignedTo | No | ID of user assigned to this task |
Implementation Reference
- src/domains/tasks.js:157-183 (schema)Input schema and description for the 'update_task' tool, defining parameters like id (required), title, status, assignedTo.{ name: 'update_task', description: 'Update an existing task', inputSchema: { type: 'object', properties: { id: { type: 'number', description: 'Task ID' }, title: { type: 'string', description: 'Task title' }, status: { type: 'string', description: 'Task status', enum: ['pending', 'in-progress', 'completed'] }, assignedTo: { type: 'number', description: 'ID of user assigned to this task' } }, required: ['id'] } }
- mcp-server.js:38-46 (registration)Tool list registration handler that includes 'update_task' schema by spreading taskToolSchemas into the list of available tools.this.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [ ...userToolSchemas, ...taskToolSchemas, searchToolSchema ] }; });
- src/domains/tasks.js:64-88 (helper)TaskService.update static method implements the business logic for updating a task by ID in the mock data store, handling partial updates.static update(id, taskData) { const taskIndex = tasks.findIndex(t => t.id === id); if (taskIndex === -1) { return { success: false, message: 'Task not found' }; } const { title, status, assignedTo } = taskData; const updatedTask = { ...tasks[taskIndex] }; if (title) updatedTask.title = title; if (status) updatedTask.status = status; if (assignedTo !== undefined) updatedTask.assignedTo = assignedTo ? parseInt(assignedTo) : null; tasks[taskIndex] = updatedTask; return { success: true, message: 'Task updated successfully', data: updatedTask }; }