autotask_delete_ticket_charge
Permanently remove a charge from a ticket, deleting all associated billing data. This action cannot be undone.
Instructions
⚠ DESTRUCTIVE — IRREVERSIBLE. Permanently deletes a ticket charge record and all associated billing data. This action cannot be undone. Confirm with the user before invoking.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ticketId | Yes | The parent ticket ID | |
| chargeId | Yes | The charge ID to delete |
Implementation Reference
- src/handlers/tool.handler.ts:854-857 (handler)Dispatch table entry for 'autotask_delete_ticket_charge' - calls AutotaskService.deleteTicketCharge(a.ticketId, a.chargeId) and returns a success message.
['autotask_delete_ticket_charge', async (a) => { await s.deleteTicketCharge(a.ticketId, a.chargeId); return { result: a.chargeId, message: `Successfully deleted ticket charge ${a.chargeId}` }; }], - Tool definition/schema for 'autotask_delete_ticket_charge' with input validation requiring ticketId and chargeId, marked as destructive/irreversible.
{ name: 'autotask_delete_ticket_charge', description: '⚠ DESTRUCTIVE — IRREVERSIBLE. Permanently deletes a ticket charge ' + 'record and all associated billing data. This action cannot be undone. ' + 'Confirm with the user before invoking.', annotations: { title: 'Delete ticket charge (irreversible)', readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: true, }, inputSchema: { type: 'object', properties: { ticketId: { type: 'number', description: 'The parent ticket ID' }, chargeId: { type: 'number', description: 'The charge ID to delete' } }, required: ['ticketId', 'chargeId'] } }, - src/handlers/tool.definitions.ts:3048-3049 (registration)Tool registration in TOOL_CATEGORIES under the 'tickets' category, listing 'autotask_delete_ticket_charge' as one of the ticket charge tools.
tools: ['autotask_search_tickets', 'autotask_get_ticket_details', 'autotask_create_ticket', 'autotask_update_ticket', 'autotask_get_ticket_note', 'autotask_search_ticket_notes', 'autotask_create_ticket_note', 'autotask_get_ticket_attachment', 'autotask_search_ticket_attachments', 'autotask_create_ticket_attachment', 'autotask_get_ticket_charge', 'autotask_search_ticket_charges', 'autotask_create_ticket_charge', 'autotask_update_ticket_charge', 'autotask_delete_ticket_charge', 'autotask_get_ticket_history', 'autotask_search_ticket_history'] }, - src/services/autotask.service.ts:536-546 (handler)Service layer method deleteTicketCharge(ticketId, chargeId) which performs the actual HTTP DELETE via http.childDelete('Tickets', ticketId, 'Charges', chargeId).
async deleteTicketCharge(ticketId: number, chargeId: number): Promise<void> { const http = await this.ensureClient(); try { this.logger.debug(`Deleting ticket charge ${chargeId} from ticket ${ticketId}`); await http.childDelete('Tickets', ticketId, 'Charges', chargeId); this.logger.info(`Ticket charge ${chargeId} deleted successfully`); } catch (error) { this.logger.error(`Failed to delete ticket charge ${chargeId}:`, error); throw error; } } - Low-level HTTP implementation childDelete() that sends DELETE /{ParentEntity}/{parentId}/{ChildEntity}/{childId} to the Autotask API.
async childDelete( parentEntity: string, parentId: number, childEntity: string, childId: number ): Promise<void> { await this.request<void>( 'DELETE', `/${parentEntity}/${parentId}/${childEntity}/${childId}` ); }