Skip to main content
Glama

deleteTask

Remove a task from Teamwork projects by specifying its ID to manage project workflows and maintain task lists.

Instructions

Delete a task from Teamwork

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
taskIdYesThe ID of the task to delete

Implementation Reference

  • The handleDeleteTask function that executes the tool logic: validates input, calls the service, logs, handles errors, and returns MCP response.
    export async function handleDeleteTask(input: any) {
      logger.info('Calling teamworkService.deleteTask()');
      logger.info(`Task ID: ${input?.taskId}`);
      
      try {
        const taskId = String(input?.taskId);
        if (!taskId) {
          throw new Error("Task ID is required");
        }
        
        const result = await teamworkService.deleteTask(taskId);
        logger.info(`Task deleted successfully for task ID: ${taskId}`);
        
        return {
          content: [{
            type: "text",
            text: JSON.stringify({ success: result }, null, 2)
          }]
        };
      } catch (error: any) {
        return createErrorResponse(error, 'Deleting task');
      }
    } 
  • Tool definition including name, description, input schema (taskId: integer, required), and annotations (destructive).
    export const deleteTaskDefinition = {
      name: "deleteTask",
      description: "Delete a task from Teamwork",
      inputSchema: {
        type: "object",
        properties: {
          taskId: {
            type: "integer",
            description: "The ID of the task to delete"
          }
        },
        required: ["taskId"]
      },
      annotations: {
        title: "Delete a Task",
        readOnlyHint: false,
        destructiveHint: true,
        openWorldHint: false
      }
    };
  • Registration of the deleteTask tool in the toolPairs array, linking definition and handler.
    { definition: deleteTask, handler: handleDeleteTask },
  • Supporting service function that performs the actual API deletion of the task via Teamwork API.
    export const deleteTask = async (taskId: string) => {
      try {
        const api = ensureApiClient();
        await api.delete(`/tasks/${taskId}.json`);
        return true;
      } catch (error: any) {
        logger.error(`Error deleting task ${taskId}: ${error.message}`);
        throw new Error(`Failed to delete task ${taskId}`);
      }
    };

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/Vizioz/Teamwork-MCP'

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