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
| Name | Required | Description | Default |
|---|---|---|---|
| expense_id | Yes | The ID of the expense to delete |
Implementation Reference
- src/tools/expenses.ts:95-113 (handler)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'); } } } - src/tools/expenses.ts:218-232 (registration)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), },