Skip to main content
Glama
rakoo04

analytics-mcp-server

by rakoo04

Run GA4 Report

ga4_run_report
Read-onlyIdempotent

Run historical Google Analytics 4 reports by specifying dimensions, metrics, date ranges, and filters, returning results as markdown or JSON.

Instructions

Run a Google Analytics 4 report over a historical date range, similar to a custom report in the GA4 UI.

Args:

  • connection (string): Name of a configured Google connection

  • property_id (string): GA4 property ID (from ga4_list_properties), digits only, no "properties/" prefix

  • start_date, end_date (string): YYYY-MM-DD, or a GA4 relative keyword such as 'today', 'yesterday', or 'NdaysAgo' (e.g. '28daysAgo')

  • dimensions (string[]): GA4 dimension API names, e.g. ["date", "country", "sessionDefaultChannelGroup"]

  • metrics (string[]): GA4 metric API names, e.g. ["activeUsers", "sessions", "conversions"]

  • limit (number): Max rows to return (default 50, max 1000)

  • offset (number): Rows to skip, for pagination (default 0)

  • dimension_filter_field, dimension_filter_value (string, optional): Restrict to rows where this dimension exactly equals this value

  • response_format ('markdown' | 'json'): Output format (default: 'markdown')

Full dimension/metric reference: https://developers.google.com/analytics/devguides/reporting/data/v1/api-schema

Returns: For JSON: { "dimensionHeaders": string[], "metricHeaders": string[], "rows": object[], "rowCount": number }

Use when: "How many sessions did we get last week by channel?" -> dimensions=["sessionDefaultChannelGroup"], metrics=["sessions"], start_date/end_date set accordingly. Don't use when: You need live/last-30-minutes data (use ga4_run_realtime_report instead).

Error Handling:

  • Returns an error naming the invalid dimension/metric if GA4 rejects the combination (not every dimension and metric can be combined).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo
offsetNo
metricsYesGA4 metric API names
end_dateYesYYYY-MM-DD, or a GA4 relative keyword such as 'today', 'yesterday', or 'NdaysAgo' (e.g. '28daysAgo')
connectionYes
dimensionsYesGA4 dimension API names
start_dateYesYYYY-MM-DD, or a GA4 relative keyword such as 'today', 'yesterday', or 'NdaysAgo' (e.g. '28daysAgo')
property_idYesGA4 property ID, digits only
response_formatNomarkdown
dimension_filter_fieldNoDimension name to filter on
dimension_filter_valueNoExact value to match, paired with dimension_filter_field

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A5/5.0
Behavior5/5

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

Annotations already mark the tool read-only, idempotent, and non-destructive. The description adds meaningful behavioral context beyond annotations: historical-only scope, pagination via limit/offset, JSON return shape, and the specific failure mode where GA4 rejects invalid dimension/metric combinations. No contradiction with annotations exists.

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?

The description is long but efficiently organized with clear sections (Args, Returns, Use when, Error Handling) and every line carries operational value. It front-loads the core purpose and then provides scannable details without filler.

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

Completeness5/5

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

For an 11-parameter reporting tool with no output schema, the description is highly complete: it covers input semantics, output JSON shape, error behavior, default response format, and pagination. The markdown output shape is not detailed, but the description gives enough context for correct selection and invocation.

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?

Despite 64% schema coverage, the description adds substantial parameter meaning: property_id format and source, date keyword forms, GA4 API names for dimensions/metrics with examples, the exact-match semantics of the filter pair, and limit/offset defaults. This goes well beyond what the schema alone provides.

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

Purpose5/5

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

The description states a specific action and resource: 'Run a Google Analytics 4 report over a historical date range, similar to a custom report in the GA4 UI.' It also references ga4_list_properties for property IDs and explicitly contrasts with ga4_run_realtime_report, making it distinguishable from siblings.

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

Usage Guidelines5/5

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

The description gives both an explicit 'Use when' example ('How many sessions did we get last week by channel?') with concrete dimension/metric guidance and a 'Don't use when' condition that names the alternative tool ga4_run_realtime_report for live data. This fully satisfies when-to-use and when-not-to-use guidance.

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