get_ticket_details
Retrieve detailed information for a specific Autotask ticket using its ID to access comprehensive ticket data when full details are required.
Instructions
Get detailed information for a specific ticket by ID. Use this for full ticket data when needed.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fullDetails | No | Whether to return full ticket details (default: false for optimized data) | |
| ticketID | Yes | Ticket ID to retrieve |
Implementation Reference
- src/services/autotask.service.ts:332-351 (handler)Main handler implementation: Fetches detailed ticket information from Autotask API using client.tickets.get(id), optionally applies data optimization.async getTicket(id: number, fullDetails: boolean = false): Promise<AutotaskTicket | null> { const client = await this.ensureClient(); try { this.logger.debug(`Getting ticket with ID: ${id}, fullDetails: ${fullDetails}`); const result = await client.tickets.get(id); const ticket = result.data as AutotaskTicket; if (!ticket) { return null; } // Apply optimization unless full details requested return fullDetails ? ticket : this.optimizeTicketData(ticket); } catch (error) { this.logger.error(`Failed to get ticket ${id}:`, error); throw error; } }
- src/handlers/tool.handler.ts:1112-1115 (handler)MCP tool handler dispatch: Receives tool call and delegates to AutotaskService.getTicket().case 'get_ticket_details': result = await this.autotaskService.getTicket(args.ticketID, args.fullDetails); message = `Ticket details retrieved successfully`; break;
- src/handlers/tool.handler.ts:268-285 (schema)Tool schema definition and registration in listTools(): Defines input schema (ticketID required, optional fullDetails) and description.name: 'get_ticket_details', description: 'Get detailed information for a specific ticket by ID. Use this for full ticket data when needed.', inputSchema: { type: 'object', properties: { ticketID: { type: 'number', description: 'Ticket ID to retrieve' }, fullDetails: { type: 'boolean', description: 'Whether to return full ticket details (default: false for optimized data)', default: false } }, required: ['ticketID'] } },
- Helper function: Optimizes ticket data by truncating large text fields (used when fullDetails=false).private optimizeTicketData(ticket: AutotaskTicket): AutotaskTicket { const maxDescriptionLength = 500; const maxNotesLength = 300; return { ...ticket, // Truncate description if too long description: ticket.description && ticket.description.length > maxDescriptionLength ? ticket.description.substring(0, maxDescriptionLength) + '... [truncated]' : ticket.description, // Remove or truncate potentially large fields resolution: ticket.resolution && ticket.resolution.length > maxNotesLength ? ticket.resolution.substring(0, maxNotesLength) + '... [truncated]' : ticket.resolution, // Remove arrays that might contain large amounts of data userDefinedFields: [], // Keep only essential custom fields, truncate if present ...(ticket.purchaseOrderNumber && { purchaseOrderNumber: ticket.purchaseOrderNumber.length > 50 ? ticket.purchaseOrderNumber.substring(0, 50) + '...' : ticket.purchaseOrderNumber }) }; }