Skip to main content
Glama
Akxan
by Akxan

GA4 period comparison

ga_compare_periods
Read-onlyIdempotent

Compare GA4 metrics between current and previous periods, broken down by dimensions like channel, with deltas and percent changes. Ideal for analyzing traffic shifts vs last month.

Instructions

Compare GA4 metrics between a current and a previous period, broken down by dimensions (default: channel group). Returns per-row current/previous/delta/percent change plus period totals. Use it for 'how did organic traffic change vs last month'.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoRows returned (sorted by absolute change of the first metric).
metricsNo
currentEndNoyesterday
dimensionsNo
propertyIdYesGA4 property ID, e.g. '123456789' (see ga_list_properties).
filterLogicNoHow to join several dimensionFilters.and
previousEndNo29daysAgo
currentStartNo28daysAgo
metricFiltersNoAND-ed metric filters (post-aggregation).
previousStartNo56daysAgo
dimensionFilterNoRaw FilterExpression; overrides dimensionFilters.
dimensionFiltersNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changedv0.10.0
    • addedInput schema / properties / dimensionFilter
      Added value: +{
      +  "description": "Raw FilterExpression; overrides dimensionFilters."
      +}
    • addedInput schema / properties / dimensionFilters / items / properties / value / description
      Added value: +"Single value, matched with matchType."
    • addedInput schema / properties / dimensionFilters / items / properties / values
      Added value: +{
      +  "description": "Match any value in this list (inListFilter), e.g. 20 page paths. Use instead of value.",
      +  "items": {
      +    "type": "string"
      +  },
      +  "minItems": 1,
      +  "type": "array"
      +}
    • changedInput schema / properties / dimensionFilters / items / required
      Previous value: -[
      -  "field",
      -  "value"
      -]New value: +[
      +  "field"
      +]
    • addedInput schema / properties / filterLogic
      Added value: +{
      +  "default": "and",
      +  "description": "How to join several dimensionFilters.",
      +  "enum": [
      +    "and",
      +    "or"
      +  ],
      +  "type": "string"
      +}
    • addedInput schema / properties / metricFilters
      Added value: +{
      +  "description": "AND-ed metric filters (post-aggregation).",
      +  "items": {
      +    "properties": {
      +      "field": {
      +        "description": "Metric API name, e.g. 'sessions'.",
      +        "type": "string"
      +      },
      +      "operation": {
      +        "default": "GREATER_THAN",
      +        "enum": [
      +          "EQUAL",
      +          "LESS_THAN",
      +          "LESS_THAN_OR_EQUAL",
      +          "GREATER_THAN",
      +          "GREATER_THAN_OR_EQUAL"
      +        ],
      +        "type": "string"
      +      },
      +      "value": {
      +        "type": "number"
      +      }
      +    },
      +    "required": [
      +      "field",
      +      "value"
      +    ],
      +    "type": "object"
      +  },
      +  "type": "array"
      +}
  2. Changed4 schema fields changedv0.5.1
    • removedInput schema / additionalProperties
      Removed value: -false
    • removedInput schema / properties / dimensionFilters / items / additionalProperties
      Removed value: -false
    • changedInput schema / properties / dimensionFilters / items / properties / field / description
      Previous value: -"Dimension API name, e.g. 'pagePath', 'sessionDefaultChannelGroup', 'country'."New value: +"Dimension API name, e.g. pagePath, country."
    • changedInput schema / properties / propertyId / description
      Previous value: -"GA4 property ID, e.g. '123456789' or 'properties/123456789'. Use ga_list_properties to discover it."New value: +"GA4 property ID, e.g. '123456789' (see ga_list_properties)."
  3. First observedv0.3.0

TDQS

A3.7/5.0
Behavior3/5

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

Annotations already declare readOnlyHint, idempotentHint, and destructiveHint, covering the safety profile. The description adds value by explaining the return structure (per-row current/previous/delta/percent change plus period totals), but it does not mention pagination, rate limits, or any other behavioral quirks. It provides some additional context beyond the annotations, but not a rich behavioral picture.

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 two sentences with no fluff. It front-loads the main action, states the output, and gives a concrete example. Every sentence earns its place, and the structure is efficient and clear.

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

Completeness2/5

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

Given the complexity (12 parameters, no output schema), the description is incomplete. It does not explain how to set date ranges, what metrics are valid, how filters work, or provide a detailed output format beyond a summary. The lack of an output schema and the minimal parameter guidance leaves significant gaps for an agent attempting to call this tool correctly.

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

Parameters2/5

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

Schema description coverage is only 42%, so the description should compensate for undocumented parameters. It only mentions the dimensions default (channel group) and does not explain date range parameters (currentStart, previousStart, etc.), metrics, or filter options. The schema provides some descriptions for limit, propertyId, filterLogic, and filters, but the description adds almost nothing beyond that. The low coverage and lack of description compensation make this a weak area.

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 clearly states a specific action (compare GA4 metrics) with a specific resource (between periods) and describes the output (per-row changes and totals). It distinguishes itself from general GA4 reporting tools by focusing on period-over-period comparison, and it gives a concrete use case. It is not a tautology and provides enough specificity to be unique among siblings.

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?

The description provides a clear example of when to use the tool ('how did organic traffic change vs last month'), which implies a period-over-period comparison scenario. However, it does not explicitly mention when not to use it or name alternative tools (e.g., ga_run_report for single-period reports). The guidance is clear but could be more explicit about exclusions.

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