MCP tool: get_tickets_analytics_by_custom_fields

Get aggregated ticket analytics data grouped by custom fields for a specific date range and team.

Example prompt

Get ticket analytics by custom fields for the last quarter

Parameters

ParameterTypeRequiredDescription
dateRangeobjectYesInclusive date range to aggregate over
dateRange.startDatestringYesStart date in YYYY-MM-DD format
dateRange.endDatestringYesEnd date in YYYY-MM-DD format
teamIdsstringNoTeam ID to filter by (optional)
customFieldUidsstringYesCustom field UID(s) to aggregate by. Can be a single UID or comma-separated list of UIDs (e.g., “uid1” or “uid1,uid2,uid3”)
includeArchivedTicketsbooleanNoInclude archived tickets (default: false)
includeTicketMetadatabooleanNoInclude minimal ticket metadata for drill-down (default: false)
metadataPagenumberNoPage number for metadata pagination (1-based, only used when includeTicketMetadata is true)
metadataLimitnumberNoLimit for metadata results per page (max 500, only used when includeTicketMetadata is true)

Response fields

The response will contain aggregated analytics data with the following structure:
FieldTypeDescription
aggregationTypestringType of aggregation performed (“custom_fields”)
totalTicketsnumberTotal number of tickets in the date range
totalFoundnumberTotal number of tickets found matching criteria
dateRangeobjectThe date range used for the analysis
includeArchivedTicketsbooleanWhether archived tickets were included
includeTicketMetadatabooleanWhether ticket metadata was included
aggregatedDataarrayArray of team-based analytics objects with custom field breakdowns

Team analytics object fields

Each team in the aggregatedData array contains:
FieldTypeDescription
teamIdstringTeam unique identifier
teamNamestringTeam name
totalTicketsWithCustomFieldsnumberTotal number of tickets with custom fields
customFieldsBreakdownarrayArray of custom field breakdown objects

Custom field breakdown fields

Each custom field in the customFieldsBreakdown array contains:
FieldTypeDescription
customFieldUidstringCustom field unique identifier
customFieldNamestringCustom field name
fieldTypestringType of custom field (e.g., “date”, “text”, “number”)
totalTicketsWithFieldnumberTotal number of tickets with this custom field
valuesarrayArray of custom field value objects

Custom field value object fields

Each value in the values array contains:
FieldTypeDescription
valuearrayArray containing the actual field value
ticketCountnumberNumber of tickets with this value
percentagenumberPercentage of total tickets
statusBreakdownobjectBreakdown by ticket status with counts and percentages
metadataobjectOptional ticket metadata with pagination info and ticket details

Sample response

{
  "aggregationType": "custom_fields",
  "totalTickets": 61,
  "totalFound": 61,
  "dateRange": {
    "startDate": "2025-01-01",
    "endDate": "2025-09-16"
  },
  "includeArchivedTickets": false,
  "includeTicketMetadata": true,
  "aggregatedData": [
    {
      "teamId": "TRRCG55TRK",
      "teamName": "Engineering",
      "totalTicketsWithCustomFields": 61,
      "customFieldsBreakdown": [
        {
          "customFieldUid": "CF33CGNNDCX",
          "customFieldName": "Due Date",
          "fieldType": "date",
          "totalTicketsWithField": 61,
          "values": [
            {
              "value": [
                {
                  "value": "2025-09-04T18:30:00.000Z"
                }
              ],
              "ticketCount": 1,
              "percentage": 1.6,
              "statusBreakdown": {
                "Resolved": {
                  "ticketCount": 1,
                  "percentage": 100,
                  "statusId": "VYSFR7XJ10BFV3ZVVAG2HG4G35ENE"
                }
              },
              "metadata": {
                "total": 1,
                "page": 1,
                "limit": 50,
                "totalPages": 1,
                "tickets": [
                  {
                    "uid": "VST3DC4K10KHFTM58AMPG051EFY86",
                    "title": "Multiple channels in account metadata",
                    "description": "",
                    "createdAt": "2025-09-05T07:40:34.489337+00:00",
                    "updatedAt": "2025-09-12T08:19:02.649333+00:00",
                    "teamId": "TRRCG55TRK",
                    "teamName": "Engineering",
                    "statusId": "VYSFR7XJ10BFV3ZVVAG2HG4G35ENE",
                    "statusName": "Resolved",
                    "assigneeId": "UTTFIEEMOB",
                    "assigneeName": "John Doe",
                    "priorityId": "EZ8VSHRJ10Y0204YMQSVVC540JH6Q",
                    "priorityName": "Urgent",
                    "sentimentId": "GZ8VSHRJ105D86K405FZXZS40843Z",
                    "sentimentName": "Neutral"
                  }
                ]
              }
            },
            {
              "value": [
                {
                  "value": "2025-09-07T18:30:00.000Z"
                }
              ],
              "ticketCount": 11,
              "percentage": 18,
              "statusBreakdown": {
                "Resolved": {
                  "ticketCount": 10,
                  "percentage": 90.9,
                  "statusId": "VYSFR7XJ10BFV3ZVVAG2HG4G35ENE"
                },
                "Verify with customer": {
                  "ticketCount": 1,
                  "percentage": 9.1,
                  "statusId": "7KCER7XJ10QW0NAM3X86PW458AQ02"
                }
              },
              "metadata": {
                "total": 11,
                "page": 1,
                "limit": 50,
                "totalPages": 1,
                "tickets": [
                  {
                    "uid": "9JXC474K10QJQ46KTZYAKDBZV3SPQ",
                    "title": "Add isPrivate to true for all orgs except thena in apps platform",
                    "description": "",
                    "createdAt": "2025-09-03T06:32:02.887569+00:00",
                    "updatedAt": "2025-09-09T09:59:57.089136+00:00",
                    "teamId": "TRRCG55TRK",
                    "teamName": "Engineering",
                    "statusId": "VYSFR7XJ10BFV3ZVVAG2HG4G35ENE",
                    "statusName": "Resolved",
                    "assigneeId": "U11QF339UH",
                    "assigneeName": "Jane Smith",
                    "priorityId": "DZ8VSHRJ102QW2P9AKXW0025F3YAH",
                    "priorityName": "Medium",
                    "sentimentId": "GZ8VSHRJ105D86K405FZXZS40843Z",
                    "sentimentName": "Neutral"
                  }
                ]
              }
            }
          ]
        }
      ]
    }
  ]
}