search_ticket_attachments
Find and retrieve attachments associated with a specific Autotask ticket using the ticket ID to access relevant files and documents.
Instructions
Search for attachments on a specific ticket
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ticketId | Yes | The ticket ID to search attachments for | |
| pageSize | No | Number of results to return (default: 10, max: 50) |
Implementation Reference
- src/handlers/tool.handler.ts:709-728 (schema)Input schema and tool definition for 'search_ticket_attachments' in listTools() - serves as both schema and registration{ name: 'search_ticket_attachments', description: 'Search for attachments on a specific ticket', inputSchema: { type: 'object', properties: { ticketId: { type: 'number', description: 'The ticket ID to search attachments for' }, pageSize: { type: 'number', description: 'Number of results to return (default: 10, max: 50)', minimum: 1, maximum: 50 } }, required: ['ticketId'] } },
- src/handlers/tool.handler.ts:1240-1243 (handler)Dispatch handler in callTool() method that invokes autotaskService.searchTicketAttachmentscase 'search_ticket_attachments': result = await this.autotaskService.searchTicketAttachments(args.ticketId, { pageSize: args.pageSize }); message = `Found ${result.length} ticket attachments`; break;
- Core implementation of searchTicketAttachments using autotask-node client.attachments.list with filter on parentIdasync searchTicketAttachments(ticketId: number, options: AutotaskQueryOptionsExtended = {}): Promise<AutotaskTicketAttachment[]> { const client = await this.ensureClient(); try { this.logger.debug(`Searching ticket attachments for ticket ${ticketId}:`, options); const optimizedOptions = { filter: [ { field: 'parentId', op: 'eq', value: ticketId } ], pageSize: options.pageSize || 10 }; const result = await client.attachments.list(optimizedOptions); const attachments = (result.data as any[]) || []; this.logger.info(`Retrieved ${attachments.length} ticket attachments`); return attachments as AutotaskTicketAttachment[]; } catch (error) { this.logger.error(`Failed to search ticket attachments for ticket ${ticketId}:`, error); throw error; } }