Skip to main content
Glama
dienhokhanh

ga4-mcp-server

by dienhokhanh

Run GA4 realtime report

run_realtime_report
Read-only

Query Google Analytics 4 realtime data from the last 30 minutes to monitor active users, event counts, and key events by country, city, device, or page.

Instructions

Report on events from the last 30 minutes (up to 60 for GA4 360). Realtime supports a limited set of fields, e.g. dimensions country, city, deviceCategory, unifiedScreenName, eventName, minutesAgo; metrics activeUsers, eventCount, keyEvents, screenPageViews.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMax rows to return (default 100; capped by GA4_MCP_MAX_ROWS).
metricsYese.g. ["activeUsers"]
orderBysNoSort order, e.g. [{"field":"sessions","desc":true}].
propertyNoGA4 property: numeric ID ("123456789"), resource name ("properties/123456789") or display name ("My Website"). Defaults to GA4_DEFAULT_PROPERTY if set.
dimensionsNo
metricFilterNoA GA4 Data API FilterExpression object. Examples: {"filter":{"fieldName":"country","stringFilter":{"matchType":"EXACT","value":"United States"}}} {"filter":{"fieldName":"eventName","inListFilter":{"values":["purchase","sign_up"]}}} {"filter":{"fieldName":"sessions","numericFilter":{"operation":"GREATER_THAN","value":{"int64Value":"100"}}}} {"andGroup":{"expressions":[<expr>,<expr>]}} · {"orGroup":{"expressions":[...]}} · {"notExpression":<expr>} stringFilter.matchType: EXACT | BEGINS_WITH | ENDS_WITH | CONTAINS | FULL_REGEXP | PARTIAL_REGEXP. Use dimension fields in dimensionFilter and metric fields in metricFilter.
minuteRangesNoDefaults to the last 30 minutes.
includeTotalsNo
dimensionFilterNoA GA4 Data API FilterExpression object. Examples: {"filter":{"fieldName":"country","stringFilter":{"matchType":"EXACT","value":"United States"}}} {"filter":{"fieldName":"eventName","inListFilter":{"values":["purchase","sign_up"]}}} {"filter":{"fieldName":"sessions","numericFilter":{"operation":"GREATER_THAN","value":{"int64Value":"100"}}}} {"andGroup":{"expressions":[<expr>,<expr>]}} · {"orGroup":{"expressions":[...]}} · {"notExpression":<expr>} stringFilter.matchType: EXACT | BEGINS_WITH | ENDS_WITH | CONTAINS | FULL_REGEXP | PARTIAL_REGEXP. Use dimension fields in dimensionFilter and metric fields in metricFilter.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.8/5.0
Behavior4/5

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

Annotations declare readOnlyHint and openWorldHint, so safety is covered. The description adds genuinely useful behavioral context beyond that: the lookback window, the GA4 360 extension to 60 minutes, and the restricted field universe that will cause failures if ignored. It omits return shape and any quota/rate-limit notes, keeping it below a 5.

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

Conciseness4/5

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

Two dense sentences with no filler; the time window is front-loaded and the field constraints follow. The field enumeration is a long run-on list but each item earns its place by preventing invalid-field calls.

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 read-only, no-output-schema tool with 9 params including nested filter expressions, the description covers the two things an agent cannot infer: the time window and the constrained field set. Remaining parameter details (minuteRanges defaults, filters, limit cap) are documented in the schema, so nothing critical is missing.

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

Parameters4/5

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

Schema coverage is 78%, so baseline is 3, but the description adds real value on the two hardest parameters: it enumerates valid realtime dimensions (country, city, deviceCategory, unifiedScreenName, eventName, minutesAgo) and metrics, which have no enums in the schema. It does not clarify limit/minuteRanges/includeTotals interaction, which the schema handles.

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?

States a specific verb and resource (report on events) plus a defining scope constraint: events from the last 30 minutes (60 for GA4 360). That window clearly separates it from the batch/historical run_report sibling in spirit, but it never names the sibling or says explicitly 'use run_report for historical data'.

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?

The 30-minute window implicitly tells the agent when this tool applies (near-real-time monitoring), and the listed field set implies constraints. However, there is no explicit when-to-use/when-not-to-use guidance and no named alternative among the many run_report/batch_run_reports/run_pivot_report siblings.

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