Skip to main content
Glama

get_ticket_details

Retrieve comprehensive information for a specific Autotask ticket by ID to access detailed data for analysis or tracking purposes.

Instructions

Get detailed information for a specific ticket by ID. Use this for full ticket data when needed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ticketIDYesTicket ID to retrieve
fullDetailsNoWhether to return full ticket details (default: false for optimized data)

Implementation Reference

  • Core implementation of ticket retrieval: calls Autotask API client.tickets.get(id), optionally optimizes output by truncating large fields.
    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; } }
  • Handler dispatch in AutotaskToolHandler.callTool(): maps tool arguments to service call.
    case 'get_ticket_details': result = await this.autotaskService.getTicket(args.ticketID, args.fullDetails); message = `Ticket details retrieved successfully`; break;
  • Tool schema definition: input schema with ticketID (required number) and optional fullDetails boolean.
    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'] } },
  • MCP server registration: setRequestHandler for ListToolsRequestSchema delegates to toolHandler.listTools() which includes get_ticket_details.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => { try { this.logger.debug('Handling list tools request'); const tools = await this.toolHandler.listTools(); return { tools }; } catch (error) { this.logger.error('Failed to list tools:', error); throw new McpError( ErrorCode.InternalError, `Failed to list tools: ${error instanceof Error ? error.message : 'Unknown error'}` ); } });
  • Data optimization helper: truncates large text fields (description, resolution) and removes unnecessary data 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 }) }; }

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/asachs01/autotask-mcp'

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