Skip to main content
Glama

GSCPAP - Google Search Console, GA4, Bing Webmaster Tools & PageSpeed MCP

Compare GA4 periods

ga4_compare_periods
Read-only

Diff the last N days vs the prior N days. Day over day, WoW, MoM, etc.

For before and after a change, give both windows: start_date/end_date for after, previous_start_date/previous_end_date for before. They need not touch or be the same length; compare totals, not sums, when they differ.

Both windows are N calendar days in the property's time zone and do not overlap. The current one ends today, and today is still filling in, so a short window (days=1 is today vs yesterday) reads low until the day is over.

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>"
    },
    "name": "ga4_compare_periods"
  }
}

Input Schema

NameRequiredDescriptionDefault
daysNowindow size (default 28 -> 28 vs prior 28; 7 for WoW; 1 for today vs yesterday)
limitNomax dimension rows in the diff (default 20)
intentNoOptional: the user's goal in a few words. No site names or URLs.
metricNoGA4 metric to compare (default "sessions"; try "activeUsers", "screenPageViews", "conversions", "totalRevenue")sessions
end_dateNooptional YYYY-MM-DD. Alone, the window is `days` days ending on this date
start_dateNooptional YYYY-MM-DD. With it the window is start_date to end_date (or today), and days is ignored
property_idYesGA4 property id
by_dimensionNodimension to slice the comparison by, or None for totals only. Common: "sessionDefaultChannelGroup", "country", "deviceCategory", "pagePath"sessionDefaultChannelGroup
dimension_filterNooptional, the same GA4 FilterExpression as in ga4_report, applied to both windows, e.g. one section only: {"filter": {"fieldName": "landingPage", "stringFilter": {"matchType": "BEGINS_WITH", "value": "/guides/"}}}
previous_end_dateNo
previous_start_dateNo

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changed
    • addedInput schema / properties / dimension_filter
      Added value: +{
      +  "anyOf": [
      +    {
      +      "additionalProperties": true,
      +      "type": "object"
      +    },
      +    {
      +      "items": {
      +        "additionalProperties": true,
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "optional, the same GA4 FilterExpression as in\nga4_report, applied to both windows, e.g. one section only:\n{\"filter\": {\"fieldName\": \"landingPage\", \"stringFilter\":\n {\"matchType\": \"BEGINS_WITH\", \"value\": \"/guides/\"}}}"
      +}
    • addedInput schema / properties / previous_end_date
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null
      +}
    • addedInput schema / properties / previous_start_date
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null
      +}
  2. Changed1 schema field changed
    • addedInput schema / properties / intent
      Added value: +{
      +  "description": "Optional: the user's goal in a few words. No site names or URLs.",
      +  "type": "string"
      +}
  3. Changed2 schema fields changed
    • addedInput schema / properties / end_date
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "optional YYYY-MM-DD. Alone, the window is `days` days\nending on this date"
      +}
    • addedInput schema / properties / start_date
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "optional YYYY-MM-DD. With it the window is start_date\nto end_date (or today), and days is ignored"
      +}
  4. First observed

TDQS

A4.2/5.0
Behavior5/5

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

Goes well beyond the annotations (readOnly/openWorld/non-destructive) by disclosing that windows are N calendar days in the property's time zone, that they must not overlap, and that today is still filling in so a days=1 window reads low. It also warns that unequal windows require comparing totals rather than sums — behavioral detail an agent could not derive from structured fields.

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?

Front-loaded with the core behavior, then progressive detail in short paragraphs; almost every sentence carries operational meaning. Slight redundancy in the caveats about window lengths and non-overlap, but nothing egregious.

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 11-parameter comparison tool with an output schema and annotations, the description covers the genuinely ambiguous parts: window construction, prior-window pairing, time zone, freshness, and unequal-length handling. Remaining gaps (dimension filter expression form, limit behavior) are handled by the schema or the referenced ga4_report convention.

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 already high (82%), and the description still adds meaning: days maps to concrete use cases (7 for WoW, 1 for today vs yesterday), adding start_date/end_date overrides days, and the previously undocumented previous_start_date/previous_end_date pair is defined here. metric and by_dimension guidance lives mostly in the schema, which is fine.

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?

Opens with a concrete verb and resource: 'Diff the last N days vs the prior N days', plus usage shorthands (DoD, WoW, MoM) that make the comparison semantics unambiguous. It does not name a sibling tool to contrast with (e.g. ga4_report or compare_periods), so an agent must infer positioning from context.

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

Usage Guidelines4/5

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

Gives clear situational guidance: use the days-based form for rolling comparisons, and supply both windows ('start_date/end_date for after, previous_start_date/previous_end_date for before') when measuring before/after a change. It stops short of explicit exclusions or naming an alternative tool for plain single-period reporting.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.