get_ticket_attachment
Retrieve a specific attachment from an Autotask PSA ticket using ticket ID and attachment ID, with optional base64 file data inclusion.
Instructions
Get a specific ticket attachment by ticket ID and attachment ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ticketId | Yes | The ticket ID | |
| attachmentId | Yes | The attachment ID to retrieve | |
| includeData | No | Whether to include base64 encoded file data (default: false) |
Implementation Reference
- Core implementation of get_ticket_attachment: queries Autotask attachments endpoint filtered by ticketId (parentId) and attachmentId.async getTicketAttachment(ticketId: number, attachmentId: number, includeData: boolean = false): Promise<AutotaskTicketAttachment | null> { const client = await this.ensureClient(); try { this.logger.debug(`Getting ticket attachment - TicketID: ${ticketId}, AttachmentID: ${attachmentId}, includeData: ${includeData}`); // Search for attachment by parent ID and attachment ID const result = await client.attachments.list({ filter: [ { field: 'parentId', op: 'eq', value: ticketId }, { field: 'id', op: 'eq', value: attachmentId } ] }); const attachments = (result.data as any[]) || []; return attachments.length > 0 ? attachments[0] as AutotaskTicketAttachment : null; } catch (error) { this.logger.error(`Failed to get ticket attachment ${attachmentId} for ticket ${ticketId}:`, error); throw error; } }
- src/handlers/tool.handler.ts:686-707 (schema)Input schema definition for the get_ticket_attachment tool, defining parameters ticketId, attachmentId, and optional includeData.{ name: 'get_ticket_attachment', description: 'Get a specific ticket attachment by ticket ID and attachment ID', inputSchema: { type: 'object', properties: { ticketId: { type: 'number', description: 'The ticket ID' }, attachmentId: { type: 'number', description: 'The attachment ID to retrieve' }, includeData: { type: 'boolean', description: 'Whether to include base64 encoded file data (default: false)', default: false } }, required: ['ticketId', 'attachmentId'] }
- src/handlers/tool.handler.ts:686-708 (registration)Tool registration in listTools(): adds get_ticket_attachment to the available MCP tools list.{ name: 'get_ticket_attachment', description: 'Get a specific ticket attachment by ticket ID and attachment ID', inputSchema: { type: 'object', properties: { ticketId: { type: 'number', description: 'The ticket ID' }, attachmentId: { type: 'number', description: 'The attachment ID to retrieve' }, includeData: { type: 'boolean', description: 'Whether to include base64 encoded file data (default: false)', default: false } }, required: ['ticketId', 'attachmentId'] } },
- src/handlers/tool.handler.ts:1235-1237 (handler)Handler dispatch in callTool(): routes get_ticket_attachment calls to autotaskService.getTicketAttachment.case 'get_ticket_attachment': result = await this.autotaskService.getTicketAttachment(args.ticketId, args.attachmentId, args.includeData); message = `Ticket attachment retrieved successfully`;