Skip to main content
Glama

ga4_cohort_retention

Calculates weekly or monthly retention of first-time GA4 users by cohort, showing active users and the share retained in each following period.

Instructions

Weekly or monthly retention of first-time users: one cohort per week (or month) of first visit, with active users in each following period and the share retained. 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
cohortsNoNumber of consecutive cohorts
periodsNoHow many periods after the first to follow
propertyNoSaved property name (see ga4_list_properties). Defaults to the default property.
start_dateYesStart of the first cohort, YYYY-MM-DD (a Monday for weekly)
granularityNoWEEKLY

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv2.1.0

TDQS

A4.4/5.0
Behavior4/5

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

With no annotations provided, the description carries the full burden and discloses real prerequisites: the Google Analytics Data API must be enabled on the quota project and the caller needs Viewer access on the GA4 property. It also explains the failure mode (access errors are self-explanatory) and points to ga4_check_access, though it says nothing about quota/rate-limit cost or pagination for a 12x12 cohort grid.

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?

Content is front-loaded: what the report is comes first, then prerequisites, then failure handling. It is compact and every clause is functional, though the mid-sentence language switch ('Lector (Viewer) en la propiedad de GA4') and the dense third sentence slightly reduce readability.

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 a read-only report tool with no output schema and adequate schema coverage, the definition supplies the missing pieces: the shape of the returned data, the data-model assumptions (first-visit cohorts), the access prerequisites, and the recovery path. An agent can decide to call it and interpret the result without further information.

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 80% (cohorts, periods, start_date, property all documented), so the baseline is 3. The description adds genuine meaning on top: it explains what a cohort and a following period actually represent in the output and ties granularity to weekly/monthly cohort construction, which the enum alone does not convey.

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 opening sentence names a specific verb and resource (retention of first-time users) and describes the exact report shape: one cohort per week/month, active users per following period, and share retained. No sibling tool covers cohort retention, so an agent can distinguish it immediately from ga4_run_report, ga4_funnel, or ga4_active_users.

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?

Usage context is clear from 'weekly or monthly retention of first-time users', and the definition routes the agent to ga4_check_access for a one-shot access check when this fails. It does not explicitly say when to prefer this over ga4_run_report or ga4_compare_periods, but the scope is narrow enough that ambiguity is low.

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