Skip to main content
Glama

delete_task

Archive a task by providing its ID, keeping historical data intact while rendering the task inactive.

Instructions

Delete (archive) a task. This action archives the task rather than permanently deleting it, preserving historical data while making it inactive.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
task_idYesThe ID of the task to delete

Implementation Reference

  • DeleteTaskHandler class implementing ToolHandler. Validates input (task_id as positive integer), calls harvestClient.deleteTask(), and returns a success message. Wraps errors via handleMCPToolError.
    class DeleteTaskHandler implements ToolHandler {
      constructor(private readonly config: BaseToolConfig) {}
    
      async execute(args: Record<string, any>): Promise<CallToolResult> {
        try {
          const inputSchema = z.object({ task_id: z.number().int().positive() });
          const { task_id } = validateInput(inputSchema, args, 'delete task');
          
          logger.info('Deleting task via Harvest API', { taskId: task_id });
          await this.config.harvestClient.deleteTask(task_id);
          
          return {
            content: [{ type: 'text', text: JSON.stringify({ message: `Task ${task_id} deleted successfully` }, null, 2) }],
          };
        } catch (error) {
          return handleMCPToolError(error, 'delete_task');
        }
      }
    }
  • Tool registration entry for 'delete_task' with name, description ('Delete (archive) a task...'), inputSchema (requires task_id number), and handler (new DeleteTaskHandler(config)).
      tool: {
        name: 'delete_task',
        description: 'Delete (archive) a task. This action archives the task rather than permanently deleting it, preserving historical data while making it inactive.',
        inputSchema: {
          type: 'object',
          properties: {
            task_id: { type: 'number', description: 'The ID of the task to delete' },
          },
          required: ['task_id'],
          additionalProperties: false,
        },
      },
      handler: new DeleteTaskHandler(config),
    },
  • TasksClient.deleteTask() - low-level HTTP client method that sends a DELETE request to /tasks/{taskId}. Logs debug/info messages and re-throws errors.
    async deleteTask(taskId: number): Promise<void> {
      try {
        this.logger.debug('Deleting task', { taskId });
        
        await this.client.delete(`/tasks/${taskId}`);
        
        this.logger.info('Successfully deleted task', { taskId });
      } catch (error) {
        this.logger.error('Failed to delete task:', error);
        throw error;
      }
    }
  • HarvestAPIClient.deleteTask() - delegates to tasksClient.deleteTask(taskId) as a thin wrapper.
    async deleteTask(taskId: number): Promise<void> {
      return this.tasksClient.deleteTask(taskId);
    }
  • src/server.ts:64-95 (registration)
    Tool registration orchestration: registerTaskTools(config) is called (line 79) and its returned registrations are stored in the tools and toolHandlers maps.
    private registerAllTools() {
      // Create a config that always references the current client
      const self = this;
      const config: BaseToolConfig = {
        get harvestClient() {
          return self.harvestClient;
        },
        logger: logger,
      };
    
      // Register all modular tools
      const toolModules = [
        registerCompanyTools(config),
        registerTimeEntryTools(config),
        registerProjectTools(config),
        registerTaskTools(config),
        registerClientTools(config),
        registerUserTools(config),
        registerInvoiceTools(config),
        registerExpenseTools(config),
        registerEstimateTools(config),
        registerReportTools(config),
      ];
    
      // Flatten and register all tools
      toolModules.forEach(toolRegistrations => {
        toolRegistrations.forEach(({ tool, handler }) => {
          this.tools.set(tool.name, tool);
          this.toolHandlers.set(tool.name, handler);
        });
      });
    }
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. It clarifies that the action archives rather than permanently deletes, which is a key behavioral trait. However, it omits details like required permissions or side effects.

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 concise, consisting of two sentences that front-load the core action. Every sentence adds value with no redundant or extraneous information.

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 simple tool with one parameter and no output schema, the description adequately explains the archival behavior. It could mention the response format or error conditions, but the current level is sufficient for basic usage.

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?

The input schema fully describes the only parameter (task_id) with a description. The tool description does not add any additional meaning beyond what the schema provides, so the baseline of 3 is appropriate.

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 tool deletes (archives) a task, distinguishing it from other operations like create_task or list_tasks. The verb 'delete (archive)' and resource 'task' are specific 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 mentions archival vs permanent deletion, implying a usage context but does not explicitly state when to use this tool over alternatives. No alternative tool for deleting tasks exists among siblings, so guidance on prerequisites or conditions is absent.

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

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/ianaleck/harvest-mcp-server'

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