Skip to main content
Glama
Google Analytics MCP Server

Google Analytics MCP Server

run_pivot_report

Read-only

Run official GA4 pivot reports with validated axes to break down metrics by dimensions, date ranges, filters, and ordering. Returns pivot headers, rows, aggregates, and quota for analysis.

Instructions

Run an official GA4 pivot report with validated pivot axes.

Args: property_id: Numeric property ID or properties/ID. report: ReportSpec: date_ranges, dimensions and metrics plus optional filters, currency_code, keep_empty_rows and return_property_quota. Use pivot-level limit, offset and order_bys, not report-level ones. pivots: Non-empty list of PivotSpec objects: field_names and positive limit required; offset, order_bys and metric_aggregations optional. Each selected dimension must occur in exactly one axis; dateRange may additionally be used for multiple date ranges. Product of limits must be <=250000.

Returns: Official pivot_headers, metric_headers, rows, aggregates, metadata and quota. Read rows using pivot_headers; they are not flattened or summed.

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>",
      "report": "<report>",
      "pivots": "<pivots>"
    },
    "name": "run_pivot_report"
  }
}

Input Schema

NameRequiredDescriptionDefault
pivotsYes
reportYesA single core report; field names use Data API snake_case.
property_idYesNumeric GA4 property ID or properties/ID; metadata property 0 is universal

Output Schema

NameRequiredDescriptionDefault
rowsNo
aggregatesNo
pivot_headersNo
metric_headersNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.1.0

TDQS

A3.9/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 adds genuine behavioral context beyond that: pivot axes must partition dimensions with each dimension appearing in exactly one axis, dateRange is the exception, and the product of axis limits must stay under 250,000. It does not mention quota consumption or error conditions, which keeps it from 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.

Conciseness3/5

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

It is front-loaded with the core purpose and then organized into Args/Returns, which is readable. But the Args block partially duplicates schema fields (required field_names/limit, property_id formats), and the axis-product limit is stated in both the description and the PivotSpec schema, so some sentences do not fully earn their place.

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?

Given three required parameters, nested PivotSpec/ReportSpec objects and an output schema, the definition covers the structurally tricky parts — axis assignment, limits, and how to read the unflattened pivot_headers-based rows. Return values are summarized appropriately rather than over-explained, since an output schema exists.

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 67% schema coverage, the description compensates well: it explains property_id accepts a bare numeric ID or properties/ID, clarifies that the report-level limit/offset/order_bys should be avoided in favor of pivot-level ones, and spells out the axis-exclusivity rule that the schema does not express. This is meaningfully more than a restatement of the schema.

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+resource: 'Run an official GA4 pivot report with validated pivot axes.' That clearly distinguishes it from a plain report tool, and the sibling list confirms siblings like run_report exist. It stops short of naming which sibling to prefer when pivots are not needed, so it is clear but not fully differentiated.

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?

There is one concrete usage rule — 'Use pivot-level limit, offset and order_bys, not report-level ones' — which prevents a real misconfiguration. However, there is no guidance on when to choose this over run_report or run_comparison_report, and no mention of prerequisites such as required GA4 scopes or property access.

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