Skip to main content
Glama
dienhokhanh

ga4-mcp-server

by dienhokhanh

Run GA4 report

run_report
Read-only

Query Google Analytics 4 properties to return traffic, top pages, conversions, or revenue as JSON rows keyed by dimension and metric name.

Instructions

Run a Google Analytics 4 report (Data API runReport). Returns rows as JSON records keyed by dimension/metric name. Examples: traffic by channel, top pages, conversions by campaign, revenue by country, daily trend with dimension "date".

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMax rows to return (default 100; capped by GA4_MCP_MAX_ROWS).
offsetNoRow offset for paging.
metricsYesMetric API names, e.g. ["activeUsers","sessions","keyEvents","totalRevenue"].
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.
dateRangesNoUp to 4 date ranges. Defaults to the last 28 days (28daysAgo → yesterday).
dimensionsNoDimension API names, e.g. ["date","sessionDefaultChannelGroup"]. Use get_metadata to discover names.
currencyCodeNoISO 4217 code, e.g. "USD". Defaults to the property currency.
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.
includeTotalsNoAlso return metric totals across all rows.
keepEmptyRowsNo
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.6/5.0
Behavior3/5

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

Annotations already declare this is a safe read (readOnlyHint=true) against an open-world backend, so the safety profile is covered. The description adds genuine behavioral value by specifying the return shape (JSON records keyed by dimension/metric), which matters because there is no output schema. It says nothing about quotas, latency on large pulls, or error behavior for a 12-parameter query tool.

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

Conciseness5/5

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

Three short sentences, with the what and the return format front-loaded and examples last. Every sentence earns its place and there is no filler.

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 12-parameter query tool with nested filter objects and no output schema, the description covers the essentials: what it does, what it returns, and representative queries. It misses pagination behavior, failure modes, and routing to similar report tools, but nothing critical to making a correct call is absent.

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

Parameters3/5

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

Schema description coverage is 92%, so the schema already documents limit/offset/metrics/dimensions/dateRanges/filters in detail and the baseline of 3 applies. The description's only parameter-level contribution is an example of using dimension "date" for a daily trend, which adds little beyond what the schema's own examples provide.

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 ('Run a Google Analytics 4 report'), names the underlying API call (Data API runReport), and describes the return shape (rows as JSON records keyed by dimension/metric name). It does not explicitly differentiate itself from close siblings like run_realtime_report, run_pivot_report, or batch_run_reports, which is the only thing keeping it out of the top tier.

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 examples ('traffic by channel, top pages, conversions by campaign') imply the kind of query this tool is for, so usage is inferable. But there is no explicit when-to-use/when-not, no routing to run_realtime_report for live data or run_pivot_report for pivots, and no mention of prerequisites such as needing a property or metric names from get_metadata.

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