update_task
Modify task details such as title, status, or assigned user on the MCP Test Server. Requires task ID to update and supports fields like status and user assignment.
Instructions
Update an existing task
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| assignedTo | No | ID of user assigned to this task | |
| id | Yes | Task ID | |
| status | No | Task status | |
| title | No | Task title |
Implementation Reference
- src/domains/tasks.js:157-183 (schema)Input schema definition for the 'update_task' tool, specifying parameters like id (required), title, status, and 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'] } }
- src/domains/tasks.js:64-88 (helper)TaskService.update method provides the core logic to update a task by ID in the mock data store, handling partial updates for title, status, and assignedTo.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 }; }
- mcp-server.js:38-46 (registration)Tool registration via the ListToolsRequestHandler, which includes taskToolSchemas containing 'update_task' in the list of available tools.this.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [ ...userToolSchemas, ...taskToolSchemas, searchToolSchema ] }; });