update_task
Modify an existing task's description or status on the coderide MCP server by providing its unique identifier (e.g., 'CRD-1'). Requires at least one update field to proceed.
Instructions
Updates an existing task's 'description' and/or 'status'. The task is identified by its unique 'number' (e.g., 'CRD-1'). At least one of 'description' or 'status' must be provided for an update.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| description | No | Optional. The new description for the task. If provided, it will replace the existing task description. | |
| number | Yes | The unique identifier for the task to be updated (e.g., 'CRD-1'). Must follow the format: three uppercase letters, a hyphen, and one or more digits. | |
| status | No | Optional. The new status for the task. Must be one of: 'to-do', 'in-progress', 'completed'. If provided, it will update the task's current status. |
Implementation Reference
- src/tools/update-task.ts:193-263 (handler)The `execute` method of `UpdateTaskTool` implements the core handler logic for the `update_task` tool. It validates input, normalizes the task number, makes a PUT request to the API endpoint `/task/number/{taskNumber}`, processes the response, and returns formatted success/error results.async execute(input: UpdateTaskInput): Promise<unknown> { logger.info('Executing update-task tool', input); try { // Use the injected API client to update task if (!this.apiClient) { throw new Error('API client not available - tool not properly initialized'); } // Extract task number const { number, ...updateData } = input; // Convert task number to uppercase for consistency const taskNumber = number.toUpperCase(); // Update task using the API endpoint const url = `/task/number/${taskNumber}`; logger.debug(`Making PUT request to: ${url}`); const responseData = await this.apiClient.put<UpdateTaskApiResponse>(url, updateData) as unknown as UpdateTaskApiResponse; if (!responseData.success) { const apiErrorMessage = responseData.message || 'API reported update failure without a specific message.'; logger.warn(`Update task API call for ${taskNumber} returned success:false. Message: ${apiErrorMessage}`); return { isError: true, content: [{ type: "text", text: `Update for task ${taskNumber} failed: ${apiErrorMessage}` }] }; } // At this point, responseData.success is true const updatedFieldsList = Object.keys(updateData).join(', ') || 'no specific fields (refresh)'; // Handle case where updateData is empty if API allows const apiMessage = responseData.message || 'Task successfully updated.'; if (responseData.task) { return { number: responseData.task.number, title: responseData.task.title, description: responseData.task.description, status: responseData.task.status, updateConfirmation: `Task ${responseData.task.number} updated fields: ${updatedFieldsList}. API: ${apiMessage}` }; } else { // responseData.success is true, but responseData.task is missing. logger.warn(`Update task API call for ${taskNumber} succeeded but returned no task data. API message: ${apiMessage}`); return { number: taskNumber, // Use input taskNumber as fallback title: '', // No title info available from response description: input.description || '', // Fallback to input description if available status: input.status || '', // Fallback to input status if available updateConfirmation: `Task ${taskNumber} update reported success by API, but full task details were not returned. Attempted to update fields: ${updatedFieldsList}. API: ${apiMessage}` }; } } catch (error) { let errorMessage = (error instanceof Error) ? error.message : 'An unknown error occurred'; logger.error(`Error in update-task tool: ${errorMessage}`, error instanceof Error ? error : undefined); // Check if it's a not found error based on API response structure or message // Note: ApiError from apiClient already provides a safeErrorMessage if (error instanceof Error && (error as any).status === 404) { errorMessage = `Task with number '${input.number}' not found.`; } else if (error instanceof Error && error.message.includes('not found')) { // Fallback for other not found indications errorMessage = `Task with number '${input.number}' not found or update failed.`; } return { isError: true, content: [{ type: "text", text: errorMessage }] }; } }
- src/tools/update-task.ts:16-43 (schema)Zod schema `UpdateTaskSchema` defines input validation for the tool, requiring a `number` matching 'ABC-123' pattern and at least one of `description` (max 2000 chars) or `status` ('to-do'|'in-progress'|'done').const UpdateTaskSchema = z.object({ // Required field to identify the task number: z.string({ required_error: "Task number is required to identify the task", invalid_type_error: "Task number must be a string" }) .regex(/^[A-Za-z]{3}-\d+$/, { message: "Task number must be in the format ABC-123 (e.g., CRD-1 or crd-1). Case insensitive." }) .describe("Task number to identify the task to update (case insensitive)"), // Optional fields that can be updated with security constraints description: z.string() .max(2000, "Description cannot exceed 2000 characters") .optional() .describe("New task description"), status: z.enum(['to-do', 'in-progress', 'done'], { invalid_type_error: "Status must be one of: to-do, in-progress, done" }).optional().describe("New task status"), }).strict().refine( // Ensure at least one field to update is provided (data) => { const updateFields = ['description', 'status']; return updateFields.some(field => field in data); }, { message: 'At least one field to update must be provided', path: ['updateFields'] } );
- src/index.ts:315-330 (registration)In `createProductionServer`, the `UpdateTaskTool` is instantiated with the `secureApiClient` dependency (line 320) and added to the `tools` array. Each tool, including `update_task`, is then registered with the MCP `server` via `tool.register(server)`.const tools: any[] = [ new StartProjectTool(secureApiClient), new GetPromptTool(secureApiClient), new GetTaskTool(secureApiClient), new GetProjectTool(secureApiClient), new UpdateTaskTool(secureApiClient), new UpdateProjectTool(secureApiClient), new ListProjectsTool(secureApiClient), new ListTasksTool(secureApiClient), new NextTaskTool(secureApiClient), ]; // Register each tool with the server tools.forEach(tool => { tool.register(server); });