delete_task
Remove a specific task from the MCP Orchestrator Server if it has no dependent tasks, ensuring clean task management and dependency integrity.
Instructions
Delete a task if it has no dependents
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| task_id | Yes | ID of the task to delete |
Implementation Reference
- src/index.ts:184-218 (handler)Handler for the 'delete_task' tool: deletes a task by ID after verifying it exists and has no dependent tasks, then saves the task list and returns confirmation.case "delete_task": { const { task_id } = request.params.arguments as { task_id: string; }; debug(`Deleting task ${task_id}`); const task = tasks[task_id]; if (!task) { throw new McpError(ErrorCode.InvalidRequest, `Task ${task_id} not found`); } // Check if any other tasks depend on this one const dependentTasks = Object.values(tasks).filter(t => t.dependencies?.includes(task_id) ); if (dependentTasks.length > 0) { throw new McpError( ErrorCode.InvalidRequest, `Cannot delete task ${task_id} as it has dependent tasks: ${dependentTasks.map(t => t.id).join(', ')}` ); } delete tasks[task_id]; saveTasks(); debug(`Deleted task ${task_id}`); return { content: [{ type: "text", text: JSON.stringify({ deleted: task_id }, null, 2) }] }; }
- src/index.ts:388-401 (registration)Registration of the 'delete_task' tool in the ListTools response, including its name, description, and input schema.{ name: "delete_task", description: "Delete a task if it has no dependents", inputSchema: { type: "object", properties: { task_id: { type: "string", description: "ID of the task to delete" } }, required: ["task_id"] } },
- src/index.ts:391-400 (schema)Input schema definition for the 'delete_task' tool, specifying the required 'task_id' parameter.inputSchema: { type: "object", properties: { task_id: { type: "string", description: "ID of the task to delete" } }, required: ["task_id"] }