search_ticket_attachments
Find and retrieve attachments associated with a specific support ticket by searching through ticket documents and files.
Instructions
Search for attachments on a specific ticket
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pageSize | No | Number of results to return (default: 10, max: 50) | |
| ticketId | Yes | The ticket ID to search attachments for |
Implementation Reference
- Main handler function that executes the core logic: queries Autotask attachments API filtered by parentId (ticket ID), with optional pagination.async 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; } }
- src/handlers/tool.handler.ts:709-728 (schema)JSON schema definition for tool inputs: requires ticketId, optional pageSize.{ 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:709-728 (registration)Tool registration in listTools() method which returns all available MCP tools including this one.{ 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)MCP tool handler dispatch case that calls the service method and formats the result.case 'search_ticket_attachments': result = await this.autotaskService.searchTicketAttachments(args.ticketId, { pageSize: args.pageSize }); message = `Found ${result.length} ticket attachments`; break;