delete_task
Remove uncompleted tasks from the MCP TaskManager queue to maintain an organized workflow and track remaining tasks.
Instructions
Delete a specific task from a request. Only uncompleted tasks can be deleted.
A progress table will be displayed showing the remaining tasks after deletion.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| requestId | Yes | ||
| taskId | Yes |
Implementation Reference
- index.ts:85-88 (schema)Zod input schema for the delete_task tool, requiring requestId and taskId.const DeleteTaskSchema = z.object({ requestId: z.string(), taskId: z.string(), });
- index.ts:190-194 (registration)Registration of the delete_task tool in the listTools method, including name, description, and schema reference.{ name: "delete_task", description: "Delete a task from a request.", inputSchema: DeleteTaskSchema, },
- index.ts:278-284 (handler)Dispatcher case in callTool method that parses input using the schema and delegates to the deleteTask handler.case "delete_task": { const parsed = DeleteTaskSchema.safeParse(parameters); if (!parsed.success) { throw new Error(`Invalid parameters: ${parsed.error}`); } return this.deleteTask(parsed.data.requestId, parsed.data.taskId); }
- index.ts:563-587 (handler)Core handler implementation: finds the request and task, validates task is not done/approved, removes the task, saves data, returns success message with updated progress.public async deleteTask(requestId: string, taskId: string) { const request = this.data.requests.find((r) => r.requestId === requestId); if (!request) { throw new Error("Request not found"); } const taskIndex = request.tasks.findIndex((t) => t.id === taskId); if (taskIndex === -1) { throw new Error("Task not found"); } const task = request.tasks[taskIndex]; if (task.done || task.approved) { throw new Error("Cannot delete completed or approved tasks"); } request.tasks.splice(taskIndex, 1); await this.saveTasks(); return { message: "Task deleted successfully.\n" + this.formatTaskProgressTable(requestId), }; }