Skip to main content
Glama
asachs01

Autotask MCP Server

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
NameRequiredDescriptionDefault
ticketIdYesThe ticket ID to search attachments for
pageSizeNoNumber of results to return (default: 10, max: 50)

Implementation Reference

  • 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']
      }
    },
  • Dispatch handler in callTool() method that invokes autotaskService.searchTicketAttachments
    case '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 parentId
    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;
      }
    }

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