Skip to main content
Glama

delete_expense

Remove an expense entry permanently from the Harvest time tracking system. This action cannot be undone.

Instructions

Delete an expense permanently. This action cannot be undone.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
expense_idYesThe ID of the expense to delete

Implementation Reference

  • The handler class implementing the deletion logic for an expense by its ID.
    class DeleteExpenseHandler implements ToolHandler {
      constructor(private readonly config: BaseToolConfig) {}
    
      async execute(args: Record<string, any>): Promise<CallToolResult> {
        try {
          const inputSchema = z.object({ expense_id: z.number().int().positive() });
          const { expense_id } = validateInput(inputSchema, args, 'delete expense');
          
          logger.info('Deleting expense via Harvest API', { expenseId: expense_id });
          await this.config.harvestClient.deleteExpense(expense_id);
          
          return {
            content: [{ type: 'text', text: JSON.stringify({ message: `Expense ${expense_id} deleted successfully` }, null, 2) }],
          };
        } catch (error) {
          return handleMCPToolError(error, 'delete_expense');
        }
      }
    }
  • The tool registration for 'delete_expense' which maps the tool name and schema to the DeleteExpenseHandler class.
    {
      tool: {
        name: 'delete_expense',
        description: 'Delete an expense permanently. This action cannot be undone.',
        inputSchema: {
          type: 'object',
          properties: {
            expense_id: { type: 'number', description: 'The ID of the expense to delete' },
          },
          required: ['expense_id'],
          additionalProperties: false,
        },
      },
      handler: new DeleteExpenseHandler(config),
    },

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