Skip to main content
Glama

ga4_pivot_report

Generate GA4 pivot reports to compare dimensions across rows and columns and return metrics for a date range, with optional metric and dimension filters.

Instructions

Pivot table report (Data API runPivotReport): rows and columns from different dimensions, e.g. platform across columns and eventName down rows. Each pivot lists its fieldNames and limit. Requires: Google Analytics Data API (analyticsdata.googleapis.com) enabled on the quota project; Lector (Viewer) en la propiedad de GA4. If it fails for access, the error explains how to fix it; ga4_check_access checks everything at once.

Input Schema

NameRequiredDescriptionDefault
pivotsYesPivot objects, e.g. [{"fieldNames":["eventName"],"limit":20},{"fieldNames":["platform"],"limit":5}]
metricsYesMetric API names
end_dateYesEnd date: YYYY-MM-DD, or relative like "today"
propertyNoSaved property name (see ga4_list_properties). Defaults to the default property.
dimensionsYesEvery dimension used in any pivot
start_dateYesStart date: YYYY-MM-DD, or relative like "7daysAgo", "yesterday", "today"
metric_filterNoData API FilterExpression for metrics, e.g. {"filter":{"fieldName":"totalUsers","numericFilter":{"operation":"GREATER_THAN","value":{"int64Value":"100"}}}}
dimension_filterNoData API FilterExpression for dimensions, e.g. {"filter":{"fieldName":"eventName","stringFilter":{"matchType":"BEGINS_WITH","value":"Checkout_"}}}

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv2.1.0

TDQS

A3.5/5.0
Behavior3/5

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

With no annotations, the description carries the full disclosure burden. It usefully reveals the auth prerequisites and states that access failures produce a self-explanatory error, but it never says this is a read-only operation, mentions no quota/rate-limit behavior, and says nothing about response shape or row limits.

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?

Three sentences, front-loaded with the core purpose and a concrete example, then prerequisites, then a troubleshooting pointer. Efficient overall, though the mid-sentence switch to Spanish ('Lector (Viewer) en la propiedad de GA4') slightly hurts readability for a general audience.

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 an 8-parameter, nested-object tool with no output schema and no annotations, the description covers purpose, an example, prerequisites, and failure handling. The main gap is that it does not describe the returned pivot structure, which an agent would need to interpret results without an output schema.

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 100%, so the schema already documents every parameter, including pivot objects with their fieldNames and limit and the requirement that dimensions cover every dimension used in any pivot. The description's pivot explanation merely restates that schema example rather than adding new semantic guidance.

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+resource (pivot table report via the Data API's runPivotReport) and explains the shape: rows and columns from different dimensions, with a concrete platform-across-columns/eventName-down-rows example. It implicitly distinguishes itself from the flat ga4_run_report, but never names that sibling or contrasts the two 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?

Gives clear usage context through prerequisites (Data API enabled on the quota project, Viewer role on the GA4 property) and points to ga4_check_access for a one-shot access check. It does not say when to choose a pivot over ga4_run_report or ga4_batch_reports, so the selection decision is left to inference.

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