Skip to main content
Glama
bsmi021

MCP Task Manager Server

by bsmi021

deleteTask

Remove one or more tasks from a specified project by providing the project ID and task IDs. Deleting a task also removes its subtasks and dependency links. Returns the count of successfully deleted tasks.

Instructions

Deletes one or more tasks within a specified project. Requires the project ID and an array of task IDs to delete. Note: Deleting a task also deletes its subtasks and dependency links due to database cascade rules. Returns the count of successfully deleted tasks.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYesThe unique identifier (UUID) of the project containing the tasks to delete. This project must exist.
task_idsYesAn array of task IDs (UUIDs, 1-100) to be deleted from the specified project.

Implementation Reference

  • The async processRequest function implements the core logic of the deleteTask tool handler. It processes the input arguments, calls TaskService.deleteTasks(project_id, task_ids), handles errors, and returns a JSON response with the deleted count.
    const processRequest = async (args: DeleteTaskArgs): Promise<{ content: { type: 'text', text: string }[] }> => {
        logger.info(`[${TOOL_NAME}] Received request to delete ${args.task_ids.length} tasks from project ${args.project_id}`);
        try {
            // Call the service method to delete the tasks
            const deletedCount = await taskService.deleteTasks(args.project_id, args.task_ids);
    
            // Format the successful response
            logger.info(`[${TOOL_NAME}] Successfully deleted ${deletedCount} tasks from project ${args.project_id}`);
            return {
                content: [{
                    type: "text" as const,
                    text: JSON.stringify({ success: true, deleted_count: deletedCount })
                }]
            };
        } catch (error: unknown) {
            // Handle potential errors according to systemPatterns.md mapping
            logger.error(`[${TOOL_NAME}] Error processing request:`, error);
    
            if (error instanceof NotFoundError) {
                // Project or one/more tasks 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 tasks.';
                throw new McpError(ErrorCode.InternalError, message);
            }
        }
    };
  • Defines TOOL_PARAMS Zod schema for input validation (project_id: uuid, task_ids: array of uuids with min/max), TOOL_NAME, TOOL_DESCRIPTION, and DeleteTaskArgs type.
    // Zod schema for the parameters, matching FR-012
    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 containing the tasks to delete. This project must exist."), // Required, UUID format
    
        task_ids: z.array(
                z.string()
                    .uuid("Each task ID must be a valid UUID.")
                    .describe("A unique identifier (UUID) of a task to delete.")
            )
            .min(1, "At least one task ID must be provided.")
            .max(100, "Cannot delete more than 100 tasks per call.")
            .describe("An array of task IDs (UUIDs, 1-100) to be deleted from the specified project."), // Required, array of UUID strings, limits
    
    });
    
    // Define the expected type for arguments based on the Zod schema
    export type DeleteTaskArgs = z.infer<typeof TOOL_PARAMS>;
  • Registers the deleteTask tool on the MCP server using server.tool() with name, description, schema.shape, and processRequest 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.`);
  • Invokes deleteTaskTool(server, taskService) within registerTools to register the tool during server setup.
    deleteTaskTool(server, taskService); // Register deleteTask tool
  • Exports the exact tool name constant TOOL_NAME = "deleteTask" used in registration.
    export const TOOL_NAME = "deleteTask";
Behavior4/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 describes key behavioral traits: the cascade effect ('deletes its subtasks and dependency links due to database cascade rules'), the return value ('Returns the count of successfully deleted tasks'), and the batch operation nature ('one or more tasks'). However, it doesn't mention permission requirements, rate limits, or error handling.

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 perfectly structured and concise with four sentences: purpose statement, parameter requirements, important behavioral note, and return value. Every sentence adds essential information with zero waste, and it's front-loaded with the core action.

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 does well by explaining the cascade behavior and return value. However, it could be more complete by mentioning authentication needs, error responses, or idempotency. Given the complexity of a batch delete operation, there's room for slightly more 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 fully documents both parameters. The description adds minimal value beyond the schema by mentioning that parameters are 'required' and that task_ids is 'an array,' but doesn't provide additional semantic context like format examples or edge cases. Baseline 3 is appropriate when schema does the heavy lifting.

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 ('Deletes') and resource ('one or more tasks within a specified project'), distinguishing it from siblings like deleteProject (which deletes projects) or setTaskStatus (which modifies tasks). 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 Guidelines3/5

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

The description implies usage context by specifying 'within a specified project' and requiring project_id and task_ids, but it doesn't explicitly state when to use this tool versus alternatives like deleteProject or updateTask. No guidance is provided on prerequisites, error conditions, or when not to use it.

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