Skip to main content
Glama
Google Analytics MCP Server

Google Analytics MCP Server

Official

run_realtime_report

Read-only

Generate realtime Google Analytics reports to analyze live user activity using dimensions, metrics, filters, ordering, and pagination.

Instructions

      Runs a Google Analytics Data API realtime report.

See
https://developers.google.com/analytics/devguides/reporting/data/v1/realtime-basics
for more information.

Args:
    property_id: The Google Analytics property ID. Accepted formats are:
      - A number
      - A string consisting of 'properties/' followed by a number
    dimensions: A list of dimensions to include in the report. Dimensions must be realtime dimensions.
    metrics: A list of metrics to include in the report. Metrics must be realtime metrics.
    dimension_filter: A Data API FilterExpression
      (https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/FilterExpression)
      to apply to the dimensions.  Don't use this for filtering metrics. Use
      metric_filter instead. The `field_name` in a `dimension_filter` must
      be a dimension, as defined in the `get_standard_dimensions` and
      `get_dimensions` tools.
      For more information about the expected format of this argument, see
      the `run_report_dimension_filter_hints` tool.
    metric_filter: A Data API FilterExpression
      (https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/FilterExpression)
      to apply to the metrics.  Don't use this for filtering dimensions. Use
      dimension_filter instead. The `field_name` in a `metric_filter` must
      be a metric, as defined in the `get_standard_metrics` and
      `get_metrics` tools.
      For more information about the expected format of this argument, see
      the `run_report_metric_filter_hints` tool.
    order_bys: A list of Data API OrderBy
      (https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/OrderBy)
      objects to apply to the dimensions and metrics.
      For more information about the expected format of this argument, see
      the `run_report_order_bys_hints` tool.
    limit: The maximum number of rows to return in each response. Value must
      be a positive integer <= 250,000. Used to paginate through large
      reports, following the guide at
      https://developers.google.com/analytics/devguides/reporting/data/v1/basics#pagination.
    offset: The row count of the start row. The first row is counted as row
      0. Used to paginate through large
      reports, following the guide at
      https://developers.google.com/analytics/devguides/reporting/data/v1/basics#pagination.
    return_property_quota: Whether to return realtime property quota in the response.
    minute_ranges: Optional minute ranges (max 2), e.g.
      [{"name": "last5", "start_minutes_ago": 4, "end_minutes_ago": 0}].
      start_minutes_ago can be at most 29. Omit for the last 30 minutes.


      ## Hints for arguments

      Here are some hints that outline the expected format and requirements
      for arguments.

      ### Hints for `dimensions`

      The `dimensions` list must consist solely of either of the following:

      1.  Realtime standard dimensions defined in the HTML table at
          https://developers.google.com/analytics/devguides/reporting/data/v1/realtime-api-schema#dimensions.
          These dimensions are available to *every* property.
      2.  User-scoped custom dimensions for the `property_id`. Use the
          `get_custom_dimensions_and_metrics` tool to retrieve the list of
          custom dimensions for a property, and look for the custom
          dimensions with an `apiName` that begins with "customUser:".

      ### Hints for `metrics`

      The `metrics` list must consist solely of the Realtime standard
      metrics defined in the HTML table at
      https://developers.google.com/analytics/devguides/reporting/data/v1/realtime-api-schema#metrics.
      These metrics are available to *every* property.

      Realtime reports can't use custom metrics.

      ### Hints for `date_ranges`:
      Example date_range arguments:
  1. A single date range:

    [ {"start_date": "2025-01-01", "end_date": "2025-01-31", "name": "Jan2025"} ]

  2. A relative date range using 'yesterday' and 'today':
    [ {"start_date": "yesterday", "end_date": "today", "name": "YesterdayAndToday"} ]

  3. A relative date range using 'NdaysAgo' and 'today':
    [ {"start_date": "30daysAgo", "end_date": "yesterday", "name": "Previous30Days"}]

  4. Multiple date ranges:
    [ {"start_date": "2025-01-01", "end_date": "2025-01-31", "name": "Jan2025"}, {"start_date": "2025-02-01", "end_date": "2025-02-28", "name": "Feb2025"} ]


      ### Hints for `minute_ranges`:
      Example minute_ranges arguments:
  1. The last 5 minutes:
    [ {"start_minutes_ago": 4, "end_minutes_ago": 0, "name": "Last5Minutes"} ]

  2. The last 5 minutes compared with the last 30 minutes:
    [ {"start_minutes_ago": 4, "end_minutes_ago": 0, "name": "Last5Minutes"}, {"start_minutes_ago": 29, "end_minutes_ago": 0, "name": "Last30Minutes"} ]

  3. A window that ends before now (15 to 29 minutes ago):
    [ {"start_minutes_ago": 29, "end_minutes_ago": 15, "name": "Earlier15Minutes"} ]

  Notes:
    - At most 2 minute ranges are allowed.
    - `start_minutes_ago` can be at most 29 for standard properties.
    - Each range counts unique users within that window, so use a minute
      range instead of summing rows of the `minutesAgo` dimension.
    - When 2 ranges are given, the response includes a `dateRange`
      dimension with each range's `name`.
    - Omit `minute_ranges` to report on the last 30 minutes.


      ### Hints for `dimension_filter`:
      Example dimension_filter arguments:
  1. A simple filter:
    {"filter": {"field_name": "eventName", "string_filter": {"match_type": 2, "value": "add", "case_sensitive": false}}}

  2. A NOT filter:
    {"not_expression": {"filter": {"field_name": "eventName", "string_filter": {"match_type": 2, "value": "add", "case_sensitive": false}}}}

  3. An empty value filter:
    {"filter": {"field_name": "source", "empty_filter": {}}}

  4. An AND group filter:
    {"and_group": {"expressions": [{"filter": {"field_name": "sourceMedium", "string_filter": {"match_type": 1, "value": "google / cpc", "case_sensitive": false}}}, {"filter": {"field_name": "eventName", "in_list_filter": {"values": ["first_visit", "purchase", "add_to_cart"], "case_sensitive": true}}}]}}

  5. An OR group filter:
    {"or_group": {"expressions": [{"filter": {"field_name": "sourceMedium", "string_filter": {"match_type": 1, "value": "google / cpc", "case_sensitive": false}}}, {"filter": {"field_name": "eventName", "in_list_filter": {"values": ["first_visit", "purchase", "add_to_cart"], "case_sensitive": true}}}]}}

Notes: The API applies the dimension_filter and metric_filter independently. As a result, some complex combinations of dimension and metric filters are not possible in a single report request.

For example, you can't create a `dimension_filter` and `metric_filter`
combination for the following condition:

(
  (eventName = "page_view" AND eventCount > 100)
  OR
  (eventName = "join_group" AND eventCount < 50)
)

This isn't possible because there's no way to apply the condition
"eventCount > 100" only to the data with eventName of "page_view", and
the condition "eventCount < 50" only to the data with eventName of
"join_group".

More generally, you can't define a `dimension_filter` and `metric_filter`
for:

(
  ((dimension condition D1) AND (metric condition M1))
  OR
  ((dimension condition D2) AND (metric condition M2))
)

If you have complex conditions like this, either:

a)  Run a single report that applies a subset of the conditions that
    the API supports as well as the data needed to perform filtering of the
    API response on the client side. For example, for the condition:
    (
      (eventName = "page_view" AND eventCount > 100)
      OR
      (eventName = "join_group" AND eventCount < 50)
    )
    You could run a report that filters only on:
    eventName one of "page_view" or "join_group"
    and include the eventCount metric, then filter the API response on the
    client side to apply the different metric filters for the different
    events.

or

b)  Run a separate report for each combination of dimension condition and
    metric condition. For the example above, you'd run one report for the
    combination of (D1 AND M1), and another report for the combination of
    (D2 AND M2).

Try to run fewer reports (option a) if possible. However, if running
fewer reports results in excessive quota usage for the API, use option
b. More information on quota usage is at
https://developers.google.com/analytics/blog/2023/data-api-quota-management.


      ### Hints for `metric_filter`:
      Example metric_filter arguments:
  1. A simple filter:
    {"filter": {"field_name": "eventCount", "numeric_filter": {"operation": 4, "value": {"int64_value": "10"}}}}

  2. A NOT filter:
    {"not_expression": {"filter": {"field_name": "eventCount", "numeric_filter": {"operation": 4, "value": {"int64_value": "10"}}}}}

  3. An empty value filter:
    {"filter": {"field_name": "purchaseRevenue", "empty_filter": {}}}

  4. An AND group filter:
    {"and_group": {"expressions": [{"filter": {"field_name": "eventCount", "numeric_filter": {"operation": 4, "value": {"int64_value": "10"}}}}, {"filter": {"field_name": "purchaseRevenue", "between_filter": {"from_value": {"double_value": 10.0}, "to_value": {"double_value": 25.0}}}}]}}

  5. An OR group filter:
    {"or_group": {"expressions": [{"filter": {"field_name": "eventCount", "numeric_filter": {"operation": 4, "value": {"int64_value": "10"}}}}, {"filter": {"field_name": "purchaseRevenue", "between_filter": {"from_value": {"double_value": 10.0}, "to_value": {"double_value": 25.0}}}}]}}

Notes: The API applies the dimension_filter and metric_filter independently. As a result, some complex combinations of dimension and metric filters are not possible in a single report request.

For example, you can't create a `dimension_filter` and `metric_filter`
combination for the following condition:

(
  (eventName = "page_view" AND eventCount > 100)
  OR
  (eventName = "join_group" AND eventCount < 50)
)

This isn't possible because there's no way to apply the condition
"eventCount > 100" only to the data with eventName of "page_view", and
the condition "eventCount < 50" only to the data with eventName of
"join_group".

More generally, you can't define a `dimension_filter` and `metric_filter`
for:

(
  ((dimension condition D1) AND (metric condition M1))
  OR
  ((dimension condition D2) AND (metric condition M2))
)

If you have complex conditions like this, either:

a)  Run a single report that applies a subset of the conditions that
    the API supports as well as the data needed to perform filtering of the
    API response on the client side. For example, for the condition:
    (
      (eventName = "page_view" AND eventCount > 100)
      OR
      (eventName = "join_group" AND eventCount < 50)
    )
    You could run a report that filters only on:
    eventName one of "page_view" or "join_group"
    and include the eventCount metric, then filter the API response on the
    client side to apply the different metric filters for the different
    events.

or

b)  Run a separate report for each combination of dimension condition and
    metric condition. For the example above, you'd run one report for the
    combination of (D1 AND M1), and another report for the combination of
    (D2 AND M2).

Try to run fewer reports (option a) if possible. However, if running
fewer reports results in excessive quota usage for the API, use option
b. More information on quota usage is at
https://developers.google.com/analytics/blog/2023/data-api-quota-management.


      ### Hints for `order_bys`:
      Example order_bys arguments:

1.  Order by ascending 'eventName':
    [ {"dimension": {"dimension_name": "eventName", "order_type": 1}, "desc": false} ]

2.  Order by descending 'eventName', ignoring case:
    [ {"dimension": {"dimension_name": "campaignName", "order_type": 2}, "desc": true} ]

3.  Order by ascending 'audienceId':
    [ {"dimension": {"dimension_name": "audienceId", "order_type": 3}, "desc": false} ]

4.  Order by descending 'eventCount':
    [ {"metric": {"metric_name": "eventValue"}, "desc": true} ]

5.  Order by ascending 'eventCount':
    [ {"metric": {"metric_name": "eventCount"}, "desc": false} ]

6.  Combination of dimension and metric order bys:
    [
      {"dimension": {"dimension_name": "eventName", "order_type": 1}, "desc": false},
      {"metric": {"metric_name": "eventValue"}, "desc": true},
    ]

7.  Order by multiple dimensions and metrics:
    [
      {"dimension": {"dimension_name": "eventName", "order_type": 1}, "desc": false},
      {"dimension": {"dimension_name": "audienceId", "order_type": 3}, "desc": false},
      {"metric": {"metric_name": "eventValue"}, "desc": true},
    ]

The dimensions and metrics in order_bys must also be present in the report
request's "dimensions" and "metrics" arguments, respectively.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "property_id": "<property_id>",
      "dimensions": "<dimensions>",
      "metrics": "<metrics>"
    },
    "name": "run_realtime_report"
  }
}

Input Schema

NameRequiredDescriptionDefault
limitNo
offsetNo
metricsYes
order_bysNo
dimensionsYes
property_idYes
metric_filterNo
minute_rangesNo
dimension_filterNo
return_property_quotaNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / properties / minute_ranges
      Added value: +{
      +  "anyOf": [
      +    {
      +      "items": {
      +        "additionalProperties": true,
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "title": "Minute Ranges"
      +}
  2. Addedv0.6.0
  3. Removedv0.5.0
  4. Changed24 schema fields changedv0.3.0
    • removedInput schema / properties / dimension_filter / additionalProperties
      Removed value: -true
    • removedInput schema / properties / dimension_filter / default
      Removed value: -null
    • addedInput schema / properties / dimension_filter / nullable
      Added value: +true
    • removedInput schema / properties / dimension_filter / title
      Removed value: -"Dimension Filter"
    • removedInput schema / properties / dimensions / title
      Removed value: -"Dimensions"
    • removedInput schema / properties / limit / default
      Removed value: -null
    • addedInput schema / properties / limit / nullable
      Added value: +true
    • removedInput schema / properties / limit / title
      Removed value: -"Limit"
    • removedInput schema / properties / metric_filter / additionalProperties
      Removed value: -true
    • removedInput schema / properties / metric_filter / default
      Removed value: -null
    • addedInput schema / properties / metric_filter / nullable
      Added value: +true
    • removedInput schema / properties / metric_filter / title
      Removed value: -"Metric Filter"
    • removedInput schema / properties / metrics / title
      Removed value: -"Metrics"
    • removedInput schema / properties / offset / default
      Removed value: -null
    • addedInput schema / properties / offset / nullable
      Added value: +true
    • removedInput schema / properties / offset / title
      Removed value: -"Offset"
    • removedInput schema / properties / order_bys / default
      Removed value: -null
    • removedInput schema / properties / order_bys / items / additionalProperties
      Removed value: -true
    • addedInput schema / properties / order_bys / nullable
      Added value: +true
    • removedInput schema / properties / order_bys / title
      Removed value: -"Order Bys"
    • removedInput schema / properties / property_id / title
      Removed value: -"Property Id"
    • removedInput schema / properties / return_property_quota / title
      Removed value: -"Return Property Quota"
    • removedInput schema / title
      Removed value: -"run_realtime_reportArguments"
    • changedOutput schema / (root)
      Previous value: -{
      -  "properties": {
      -    "result": {
      -      "additionalProperties": true,
      -      "title": "Result",
      -      "type": "object"
      -    }
      -  },
      -  "required": [
      -    "result"
      -  ],
      -  "title": "run_realtime_reportOutput",
      -  "type": "object"
      -}New value: +null
  5. First observed

TDQS

A3.8/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true, destructiveHint=false and openWorldHint=true, so the safety profile is covered; the description still adds real behavioral context: the independent application of dimension_filter and metric_filter, the workarounds when a combined condition is impossible, quota trade-offs between the two workarounds, response behavior when two minute ranges are supplied, and the default of the last 30 minutes when minute_ranges is omitted.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness2/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Structure is headed and largely front-loaded, but the long 'Notes' block about dimension_filter/metric_filter interactions is pasted verbatim twice, and a full 'Hints for date_ranges' section with four examples documents a parameter this tool does not have. Those are substantial wastes and actively misleading for a realtime endpoint.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a complex 10-parameter reporting tool with no output schema, the description is nearly complete: it covers every real parameter with examples and constraints and points to the hint tools and API docs for deeper detail. The stray date_ranges section is the one gap, since it invites an argument the tool does not accept and omits any description of the response structure.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage across 10 parameters, the description carries the full burden and does so: it gives accepted property_id formats, realtime-only rules for dimensions and metrics, worked JSON examples for both filters, order_bys and minute_ranges, pagination semantics for limit/offset, and the bound on start_minutes_ago.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb and resource plus a scope qualifier: 'Runs a Google Analytics Data API realtime report.' The word 'realtime' is what distinguishes it from the sibling run_report/run_conversions_report/run_funnel_report tools, though the description never states that contrast explicitly.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage constraints are spelled out for the arguments (dimensions/metrics must be realtime, custom metrics are not allowed, at most 2 minute ranges, limit <= 250,000), but there is no statement of when to pick this tool over the sibling run_report, i.e. no 'use this for last-30-minutes data, use run_report for historical ranges'. When-to-use versus alternatives is left to inference from the word 'realtime'.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.