MCP Tools Reference: analyticsdata.googleapis.com

Tool: check_compatibility

This compatibility method lists dimensions and metrics that can be added to a report request and maintain compatibility.

The following sample demonstrate how to use curl to invoke the check_compatibility MCP tool.

Curl Request
                  
curl --location 'https://analyticsdata.googleapis.com/mcp/v1' \
--header 'content-type: application/json' \
--header 'accept: application/json, text/event-stream' \
--data '{
  "method": "tools/call",
  "params": {
    "name": "check_compatibility",
    "arguments": {
      // provide these details according to the tool's MCP specification
    }
  },
  "jsonrpc": "2.0",
  "id": 1
}'
                

Input Schema

The request for compatibility information for a report's dimensions and metrics. Check compatibility provides a preview of the compatibility of a report; fields shared with the runReport request should be the same values as in your runReport request.

CheckCompatibilityRequest

JSON representation
{
  "property": string,
  "dimensions": [
    {
      object (Dimension)
    }
  ],
  "metrics": [
    {
      object (Metric)
    }
  ],
  "dimensionFilter": {
    object (FilterExpression)
  },
  "metricFilter": {
    object (FilterExpression)
  },
  "compatibilityFilter": enum (Compatibility)
}
Fields
property

string

A Google Analytics property identifier whose events are tracked. To learn more, see where to find your Property ID. property should be the same value as in your runReport request.

Example: properties/1234

dimensions[]

object (Dimension)

The dimensions in this report. dimensions should be the same value as in your runReport request.

metrics[]

object (Metric)

The metrics in this report. metrics should be the same value as in your runReport request.

dimensionFilter

object (FilterExpression)

The filter clause of dimensions. dimensionFilter should be the same value as in your runReport request.

metricFilter

object (FilterExpression)

The filter clause of metrics. metricFilter should be the same value as in your runReport request

compatibilityFilter

enum (Compatibility)

Filters the dimensions and metrics in the response to just this compatibility. Commonly used as ”compatibilityFilter”: “COMPATIBLE” to only return compatible dimensions & metrics.

Dimension

JSON representation
{
  "name": string,
  "dimensionExpression": {
    object (DimensionExpression)
  }
}
Fields
name

string

The name of the dimension. See the API Dimensions for the list of dimension names supported by core reporting methods such as runReport and batchRunReports. See Realtime Dimensions for the list of dimension names supported by the runRealtimeReport method. See Funnel Dimensions for the list of dimension names supported by the runFunnelReport method.

If dimensionExpression is specified, name can be any string that you would like within the allowed character set. For example if a dimensionExpression concatenates country and city, you could call that dimension countryAndCity. Dimension names that you choose must match the regular expression ^[a-zA-Z0-9_]$.

Dimensions are referenced by name in dimensionFilter, orderBys, dimensionExpression, and pivots.

dimensionExpression

object (DimensionExpression)

One dimension can be the result of an expression of multiple dimensions. For example, dimension "country, city": concatenate(country, ", ", city).

DimensionExpression

JSON representation
{

  // Union field one_expression can be only one of the following:
  "lowerCase": {
    object (CaseExpression)
  },
  "upperCase": {
    object (CaseExpression)
  },
  "concatenate": {
    object (ConcatenateExpression)
  }
  // End of list of possible types for union field one_expression.
}
Fields
Union field one_expression. Specify one type of dimension expression for DimensionExpression. one_expression can be only one of the following:
lowerCase

object (CaseExpression)

Used to convert a dimension value to lower case.

upperCase

object (CaseExpression)

Used to convert a dimension value to upper case.

concatenate

object (ConcatenateExpression)

Used to combine dimension values to a single dimension. For example, dimension "country, city": concatenate(country, ", ", city).

CaseExpression

JSON representation
{
  "dimensionName": string
}
Fields
dimensionName

string

Name of a dimension. The name must refer back to a name in dimensions field of the request.

ConcatenateExpression

JSON representation
{
  "dimensionNames": [
    string
  ],
  "delimiter": string
}
Fields
dimensionNames[]

string

Names of dimensions. The names must refer back to names in the dimensions field of the request.

delimiter

string

The delimiter placed between dimension names.

Delimiters are often single characters such as "|" or "," but can be longer strings. If a dimension value contains the delimiter, both will be present in response with no distinction. For example if dimension 1 value = "US,FR", dimension 2 value = "JP", and delimiter = ",", then the response will contain "US,FR,JP".

Metric

JSON representation
{
  "name": string,
  "expression": string,
  "invisible": boolean
}
Fields
name

string

The name of the metric. See the API Metrics for the list of metric names supported by core reporting methods such as runReport and batchRunReports. See Realtime Metrics for the list of metric names supported by the runRealtimeReport method. See Funnel Metrics for the list of metric names supported by the runFunnelReport method.

If expression is specified, name can be any string that you would like within the allowed character set. For example if expression is screenPageViews/sessions, you could call that metric's name = viewsPerSession. Metric names that you choose must match the regular expression ^[a-zA-Z0-9_]$.

Metrics are referenced by name in metricFilter, orderBys, and metric expression.

expression

string

A mathematical expression for derived metrics. For example, the metric Event count per user is eventCount/totalUsers.

invisible

boolean

Indicates if a metric is invisible in the report response. If a metric is invisible, the metric will not produce a column in the response, but can be used in metricFilter, orderBys, or a metric expression.

FilterExpression

JSON representation
{

  // Union field expr can be only one of the following:
  "andGroup": {
    object (FilterExpressionList)
  },
  "orGroup": {
    object (FilterExpressionList)
  },
  "notExpression": {
    object (FilterExpression)
  },
  "filter": {
    object (Filter)
  }
  // End of list of possible types for union field expr.
}
Fields
Union field expr. Specify one type of filter expression for FilterExpression. expr can be only one of the following:
andGroup

object (FilterExpressionList)

The FilterExpressions in and_group have an AND relationship.

orGroup

object (FilterExpressionList)

The FilterExpressions in or_group have an OR relationship.

notExpression

object (FilterExpression)

The FilterExpression is NOT of not_expression.

filter

object (Filter)

A primitive filter. In the same FilterExpression, all of the filter's field names need to be either all dimensions or all metrics.

FilterExpressionList

JSON representation
{
  "expressions": [
    {
      object (FilterExpression)
    }
  ]
}
Fields
expressions[]

object (FilterExpression)

A list of filter expressions.

Filter

JSON representation
{
  "fieldName": string,

  // Union field one_filter can be only one of the following:
  "stringFilter": {
    object (StringFilter)
  },
  "inListFilter": {
    object (InListFilter)
  },
  "numericFilter": {
    object (NumericFilter)
  },
  "betweenFilter": {
    object (BetweenFilter)
  },
  "emptyFilter": {
    object (EmptyFilter)
  }
  // End of list of possible types for union field one_filter.
}
Fields
fieldName

string

The dimension name or metric name.

In most methods, dimensions & metrics can be used for the first time in this field. However in a RunPivotReportRequest, this field must be additionally specified by name in the RunPivotReportRequest's dimensions or metrics.

Union field one_filter. Specify one type of filter for Filter. one_filter can be only one of the following:
stringFilter

object (StringFilter)

Strings related filter.

inListFilter

object (InListFilter)

A filter for in list values.

numericFilter

object (NumericFilter)

A filter for numeric or date values.

betweenFilter

object (BetweenFilter)

A filter for two values.

emptyFilter

object (EmptyFilter)

A filter for empty values such as "(not set)" and "" values.

StringFilter

JSON representation
{
  "matchType": enum (MatchType),
  "value": string,
  "caseSensitive": boolean
}
Fields
matchType

enum (MatchType)

The match type for this filter.

value

string

The string value used for the matching.

caseSensitive

boolean

If true, the string value is case sensitive.

InListFilter

JSON representation
{
  "values": [
    string
  ],
  "caseSensitive": boolean
}
Fields
values[]

string

The list of string values. Must be non-empty.

caseSensitive

boolean

If true, the string value is case sensitive.

NumericFilter

JSON representation
{
  "operation": enum (Operation),
  "value": {
    object (NumericValue)
  }
}
Fields
operation

enum (Operation)

The operation type for this filter.

value

object (NumericValue)

A numeric value or a date value.

NumericValue

JSON representation
{

  // Union field one_value can be only one of the following:
  "int64Value": string,
  "doubleValue": number
  // End of list of possible types for union field one_value.
}
Fields
Union field one_value. One of a numeric value one_value can be only one of the following:
int64Value

string (int64 format)

Integer value

doubleValue

number

Double value

BetweenFilter

JSON representation
{
  "fromValue": {
    object (NumericValue)
  },
  "toValue": {
    object (NumericValue)
  }
}
Fields
fromValue

object (NumericValue)

Begins with this number.

toValue

object (NumericValue)

Ends with this number.

MatchType

The match type of a string filter

Enums
MATCH_TYPE_UNSPECIFIED Unspecified
EXACT Exact match of the string value.
BEGINS_WITH Begins with the string value.
ENDS_WITH Ends with the string value.
CONTAINS Contains the string value.
FULL_REGEXP Full match for the regular expression with the string value.
PARTIAL_REGEXP Partial match for the regular expression with the string value.

Operation

The operation applied to a numeric filter

Enums
OPERATION_UNSPECIFIED Unspecified.
EQUAL Equal
LESS_THAN Less than
LESS_THAN_OR_EQUAL Less than or equal
GREATER_THAN Greater than
GREATER_THAN_OR_EQUAL Greater than or equal

Compatibility

The compatibility types for a single dimension or metric.

Enums
COMPATIBILITY_UNSPECIFIED Unspecified compatibility.
COMPATIBLE The dimension or metric is compatible. This dimension or metric can be successfully added to a report.
INCOMPATIBLE The dimension or metric is incompatible. This dimension or metric cannot be successfully added to a report.

Output Schema

The compatibility response with the compatibility of each dimension & metric.

CheckCompatibilityResponse

JSON representation
{
  "dimensionCompatibilities": [
    {
      object (DimensionCompatibility)
    }
  ],
  "metricCompatibilities": [
    {
      object (MetricCompatibility)
    }
  ]
}
Fields
dimensionCompatibilities[]

object (DimensionCompatibility)

The compatibility of each dimension.

metricCompatibilities[]

object (MetricCompatibility)

The compatibility of each metric.

DimensionCompatibility

JSON representation
{

  // Union field _dimension_metadata can be only one of the following:
  "dimensionMetadata": {
    object (DimensionMetadata)
  }
  // End of list of possible types for union field _dimension_metadata.

  // Union field _compatibility can be only one of the following:
  "compatibility": enum (Compatibility)
  // End of list of possible types for union field _compatibility.
}
Fields

Union field _dimension_metadata.

_dimension_metadata can be only one of the following:

dimensionMetadata

object (DimensionMetadata)

The dimension metadata contains the API name for this compatibility information. The dimension metadata also contains other helpful information like the UI name and description.

Union field _compatibility.

_compatibility can be only one of the following:

compatibility

enum (Compatibility)

The compatibility of this dimension. If the compatibility is COMPATIBLE, this dimension can be successfully added to the report.

DimensionMetadata

JSON representation
{
  "apiName": string,
  "uiName": string,
  "description": string,
  "deprecatedApiNames": [
    string
  ],
  "customDefinition": boolean,
  "category": string
}
Fields
apiName

string

This dimension's name. Useable in Dimension's name. For example, eventName.

uiName

string

This dimension's name within the Google Analytics user interface. For example, Event name.

description

string

Description of how this dimension is used and calculated.

deprecatedApiNames[]

string

Still usable but deprecated names for this dimension. If populated, this dimension is available by either apiName or one of deprecatedApiNames for a period of time. After the deprecation period, the dimension will be available only by apiName.

customDefinition

boolean

True if the dimension is custom to this property. This includes user, event, & item scoped custom dimensions; to learn more about custom dimensions, see https://support.google.com/analytics/answer/14240153. This also include custom channel groups; to learn more about custom channel groups, see https://support.google.com/analytics/answer/13051316.

category

string

The display name of the category that this dimension belongs to. Similar dimensions and metrics are categorized together.

MetricCompatibility

JSON representation
{

  // Union field _metric_metadata can be only one of the following:
  "metricMetadata": {
    object (MetricMetadata)
  }
  // End of list of possible types for union field _metric_metadata.

  // Union field _compatibility can be only one of the following:
  "compatibility": enum (Compatibility)
  // End of list of possible types for union field _compatibility.
}
Fields

Union field _metric_metadata.

_metric_metadata can be only one of the following:

metricMetadata

object (MetricMetadata)

The metric metadata contains the API name for this compatibility information. The metric metadata also contains other helpful information like the UI name and description.

Union field _compatibility.

_compatibility can be only one of the following:

compatibility

enum (Compatibility)

The compatibility of this metric. If the compatibility is COMPATIBLE, this metric can be successfully added to the report.

MetricMetadata

JSON representation
{
  "apiName": string,
  "uiName": string,
  "description": string,
  "deprecatedApiNames": [
    string
  ],
  "type": enum (MetricType),
  "expression": string,
  "customDefinition": boolean,
  "blockedReasons": [
    enum (BlockedReason)
  ],
  "category": string
}
Fields
apiName

string

A metric name. Useable in Metric's name. For example, eventCount.

uiName

string

This metric's name within the Google Analytics user interface. For example, Event count.

description

string

Description of how this metric is used and calculated.

deprecatedApiNames[]

string

Still usable but deprecated names for this metric. If populated, this metric is available by either apiName or one of deprecatedApiNames for a period of time. After the deprecation period, the metric will be available only by apiName.

type

enum (MetricType)

The type of this metric.

expression

string

The mathematical expression for this derived metric. Can be used in Metric's expression field for equivalent reports. Most metrics are not expressions, and for non-expressions, this field is empty.

customDefinition

boolean

True if the metric is a custom metric for this property.

blockedReasons[]

enum (BlockedReason)

If reasons are specified, your access is blocked to this metric for this property. API requests from you to this property for this metric will succeed; however, the report will contain only zeros for this metric. API requests with metric filters on blocked metrics will fail. If reasons are empty, you have access to this metric.

To learn more, see Access and data-restriction management.

category

string

The display name of the category that this metrics belongs to. Similar dimensions and metrics are categorized together.

Compatibility

The compatibility types for a single dimension or metric.

Enums
COMPATIBILITY_UNSPECIFIED Unspecified compatibility.
COMPATIBLE The dimension or metric is compatible. This dimension or metric can be successfully added to a report.
INCOMPATIBLE The dimension or metric is incompatible. This dimension or metric cannot be successfully added to a report.

MetricType

A metric's value type.

Enums
METRIC_TYPE_UNSPECIFIED Unspecified type.
TYPE_INTEGER Integer type.
TYPE_FLOAT Floating point type.
TYPE_SECONDS A duration of seconds; a special floating point type.
TYPE_MILLISECONDS A duration in milliseconds; a special floating point type.
TYPE_MINUTES A duration in minutes; a special floating point type.
TYPE_HOURS A duration in hours; a special floating point type.
TYPE_STANDARD A custom metric of standard type; a special floating point type.
TYPE_CURRENCY An amount of money; a special floating point type.
TYPE_FEET A length in feet; a special floating point type.
TYPE_MILES A length in miles; a special floating point type.
TYPE_METERS A length in meters; a special floating point type.
TYPE_KILOMETERS A length in kilometers; a special floating point type.

BlockedReason

Justifications for why this metric is blocked.

Enums
BLOCKED_REASON_UNSPECIFIED Will never be specified in API response.
NO_REVENUE_METRICS If present, your access is blocked to revenue related metrics for this property, and this metric is revenue related.
NO_COST_METRICS If present, your access is blocked to cost related metrics for this property, and this metric is cost related.

Tool Annotations

Destructive Hint: ❌ | Idempotent Hint: ✅ | Read Only Hint: ✅ | Open World Hint: ✅