Skip to main content
Glama
bsmi021

MCP Task Manager Server

by bsmi021

deleteProject

Permanently deletes a project, including all associated tasks and dependencies, using the project ID. Returns a success confirmation. Ensure the action is intended, as it cannot be undone.

Instructions

Permanently deletes a project and ALL associated tasks and dependencies. Requires the project ID. This is a highly destructive operation and cannot be undone. Returns a success confirmation upon completion.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYesThe unique identifier (UUID) of the project to permanently delete. This project must exist.

Implementation Reference

  • The MCP tool handler: processRequest function executes the deleteProject logic by calling ProjectService.deleteProject, logs actions, returns JSON success response, and maps errors to McpError types.
    const processRequest = async (args: DeleteProjectArgs): Promise<{ content: { type: 'text', text: string }[] }> => {
        logger.warn(`[${TOOL_NAME}] Received request to DELETE project ${args.project_id}. This is a destructive operation.`); // Log deletion intent clearly
        try {
            // Call the service method to delete the project
            const success = await projectService.deleteProject(args.project_id);
    
            // Format the successful response
            logger.info(`[${TOOL_NAME}] Successfully deleted project ${args.project_id}`);
            return {
                content: [{
                    type: "text" as const,
                    text: JSON.stringify({ success: success }) // Return true if deleted
                }]
            };
        } catch (error: unknown) {
            // Handle potential errors according to systemPatterns.md mapping
            logger.error(`[${TOOL_NAME}] Error processing request:`, error);
    
            if (error instanceof NotFoundError) {
                // Project not found - Map to InvalidParams as per convention
                throw new McpError(ErrorCode.InvalidParams, error.message);
            } else {
                // Generic internal error
                const message = error instanceof Error ? error.message : 'An unknown error occurred while deleting the project.';
                throw new McpError(ErrorCode.InternalError, message);
            }
        }
    };
  • Defines the tool name 'deleteProject', description, Zod input schema TOOL_PARAMS requiring project_id UUID, and inferred DeleteProjectArgs type.
    export const TOOL_NAME = "deleteProject";
    
    export const TOOL_DESCRIPTION = `
    Permanently deletes a project and ALL associated tasks and dependencies.
    Requires the project ID. This is a highly destructive operation and cannot be undone.
    Returns a success confirmation upon completion.
    `;
    
    // Zod schema for the parameters, matching FR-013
    export const TOOL_PARAMS = z.object({
        project_id: z.string()
            .uuid("The project_id must be a valid UUID.")
            .describe("The unique identifier (UUID) of the project to permanently delete. This project must exist."), // Required, UUID format
    
    });
    
    // Define the expected type for arguments based on the Zod schema
    export type DeleteProjectArgs = z.infer<typeof TOOL_PARAMS>;
  • Registers the deleteProject tool on the McpServer instance using server.tool() with name, description, params schema, and handler.
    // Register the tool with the server
    server.tool(TOOL_NAME, TOOL_DESCRIPTION, TOOL_PARAMS.shape, processRequest); // Using .shape as this schema doesn't use .refine()
    
    logger.info(`[${TOOL_NAME}] Tool registered successfully.`);
  • Central registration: calls deleteProjectTool(server, projectService) from within registerTools() to register the tool.
    deleteProjectTool(server, projectService); // Register deleteProject tool (uses ProjectService)
  • ProjectService.deleteProject: validates project exists, calls repository to delete (cascades to tasks/dependencies), returns true on success.
    public async deleteProject(projectId: string): Promise<boolean> {
        logger.info(`[ProjectService] Attempting to delete project: ${projectId}`);
    
        // 1. Validate Project Existence *before* attempting delete
        const projectExists = this.projectRepository.findById(projectId);
        if (!projectExists) {
            logger.warn(`[ProjectService] Project not found for deletion: ${projectId}`);
            throw new NotFoundError(`Project with ID ${projectId} not found.`);
        }
    
        // 2. Call Repository delete method
        try {
            // The repository method handles the actual DELETE operation on the projects table.
            // Cascade delete defined in the schema handles tasks and dependencies.
            const deletedCount = this.projectRepository.deleteProject(projectId);
    
            if (deletedCount !== 1) {
                // This shouldn't happen if findById succeeded, but log a warning if it does.
                logger.warn(`[ProjectService] Expected to delete 1 project, but repository reported ${deletedCount} deletions for project ${projectId}.`);
                // Still return true as the project is gone, but log indicates potential issue.
            }
    
            logger.info(`[ProjectService] Successfully deleted project ${projectId} and associated data.`);
            return true; // Indicate success
    
        } catch (error) {
            logger.error(`[ProjectService] Error deleting project ${projectId}:`, error);
            throw error; // Re-throw database or other errors
        }
    }
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively communicates key traits: the operation is 'highly destructive,' 'cannot be undone,' deletes 'ALL associated tasks and dependencies,' and 'returns a success confirmation.' This covers safety, side effects, and output expectations comprehensively.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the core action and impact, followed by parameter and behavioral details in three concise sentences. Each sentence adds critical information (destructive nature, parameter requirement, confirmation output) with zero waste or redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a destructive tool with no annotations and no output schema, the description is highly complete: it explains the action, scope (project+tasks+dependencies), irreversible nature, parameter need, and confirmation return. The only minor gap is lack of explicit error cases or permissions, but it compensates well given the context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents the project_id parameter as a required UUID for an existing project. The description adds minimal value beyond this, only stating 'Requires the project ID' without additional context like format or validation rules. This meets the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('permanently deletes') and resource ('a project and ALL associated tasks and dependencies'), distinguishing it from siblings like deleteTask (which only deletes tasks) and createProject (which creates rather than deletes). The verb+resource combination is precise and unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context that this is for deleting projects and their associated content, implying it should be used when complete project removal is needed. However, it does not explicitly state when NOT to use it (e.g., vs. deleteTask for individual tasks) or name alternatives, though the sibling list includes deleteTask as a logical alternative.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/bsmi021/mcp-task-manager-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server