deleteTask
Remove a task from Teamwork projects by specifying its ID to manage project workflows and maintain task lists.
Instructions
Delete a task from Teamwork
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| taskId | Yes | The ID of the task to delete |
Implementation Reference
- src/tools/tasks/deleteTask.ts:33-55 (handler)The handleDeleteTask function that executes the tool logic: validates input, calls the service, logs, handles errors, and returns MCP response.export async function handleDeleteTask(input: any) { logger.info('Calling teamworkService.deleteTask()'); logger.info(`Task ID: ${input?.taskId}`); try { const taskId = String(input?.taskId); if (!taskId) { throw new Error("Task ID is required"); } const result = await teamworkService.deleteTask(taskId); logger.info(`Task deleted successfully for task ID: ${taskId}`); return { content: [{ type: "text", text: JSON.stringify({ success: result }, null, 2) }] }; } catch (error: any) { return createErrorResponse(error, 'Deleting task'); } }
- src/tools/tasks/deleteTask.ts:11-30 (schema)Tool definition including name, description, input schema (taskId: integer, required), and annotations (destructive).export const deleteTaskDefinition = { name: "deleteTask", description: "Delete a task from Teamwork", inputSchema: { type: "object", properties: { taskId: { type: "integer", description: "The ID of the task to delete" } }, required: ["taskId"] }, annotations: { title: "Delete a Task", readOnlyHint: false, destructiveHint: true, openWorldHint: false } };
- src/tools/index.ts:77-77 (registration)Registration of the deleteTask tool in the toolPairs array, linking definition and handler.{ definition: deleteTask, handler: handleDeleteTask },
- Supporting service function that performs the actual API deletion of the task via Teamwork API.export const deleteTask = async (taskId: string) => { try { const api = ensureApiClient(); await api.delete(`/tasks/${taskId}.json`); return true; } catch (error: any) { logger.error(`Error deleting task ${taskId}: ${error.message}`); throw new Error(`Failed to delete task ${taskId}`); } };