delete_project
Safely remove completed or obsolete projects from your workspace by specifying the project ID and confirming the deletion. Ensures permanent cleanup of project data while preventing accidental deletions for better organization.
Instructions
Safely remove completed or obsolete projects from your workspace with built-in confirmation safeguards. Permanently cleans up project data while protecting against accidental deletions, helping maintain an organized and current project portfolio.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| confirm | Yes | Must be set to true to confirm deletion (safety measure) | |
| id | Yes | The unique identifier of the project to delete | |
| workingDirectory | Yes | The full absolute path to the working directory where data is stored. MUST be an absolute path, never relative. Windows: "C:\Users\username\project" or "D:\projects\my-app". Unix/Linux/macOS: "/home/username/project" or "/Users/username/project". Do NOT use: ".", "..", "~", "./folder", "../folder" or any relative paths. Ensure the path exists and is accessible before calling this tool. NOTE: When server is started with --claude flag, this parameter is ignored and a global user directory is used instead. |
Implementation Reference
- The MCP tool handler function for 'delete_project' that validates input, confirms deletion, deletes the project and associated tasks/subtasks via storage, and returns formatted response.handler: async ({ id, confirm }: { id: string; confirm: boolean }) => { try { // Validate inputs if (!id || id.trim().length === 0) { return { content: [{ type: 'text' as const, text: 'Error: Project ID is required.' }], isError: true }; } if (confirm !== true) { return { content: [{ type: 'text' as const, text: 'Error: You must set confirm to true to delete a project.' }], isError: true }; } const project = await storage.getProject(id.trim()); if (!project) { return { content: [{ type: 'text' as const, text: `Error: Project with ID "${id}" not found. Use list_projects to see all available projects.` }], isError: true }; } // Get counts for confirmation message const tasks = await storage.getTasks(project.id); const subtasks = await storage.getSubtasks(undefined, project.id); const deleted = await storage.deleteProject(id); if (!deleted) { return { content: [{ type: 'text' as const, text: `Error: Failed to delete project with ID "${id}".` }], isError: true }; } return { content: [{ type: 'text' as const, text: `✅ Project deleted successfully! **Deleted:** "${project.name}" (ID: ${project.id}) **Also deleted:** ${tasks.length} task(s) and ${subtasks.length} subtask(s) This action cannot be undone. All data associated with this project has been permanently removed.` }] }; } catch (error) { return { content: [{ type: 'text' as const, text: `Error deleting project: ${error instanceof Error ? error.message : 'Unknown error'}` }], isError: true }; } }
- Zod input schema for delete_project tool: requires project id (string) and confirm (boolean).inputSchema: { id: z.string(), confirm: z.boolean() },
- FileStorage implementation of deleteProject: removes project from storage, deletes all associated tasks, saves changes.async deleteProject(id: string): Promise<boolean> { const index = this.data.projects.findIndex(p => p.id === id); if (index === -1) return false; this.data.projects.splice(index, 1); // Also delete all related tasks (including nested ones) await this.deleteTasksByProject(id); await this.save(); return true; }
- Storage interface defining deleteProject method signature.deleteProject(id: string): Promise<boolean>;