GA4 MCP Server
Allows for the retrieval and listing of Google Ads accounts linked to specific Google Analytics 4 properties.
Provides comprehensive tools for querying Google Analytics 4 (GA4) data, including property management, report execution via the Data API, and realtime data monitoring.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@GA4 MCP Servershow me a report of active users by country for the last 30 days"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
GA4 MCP Server
A Model Context Protocol (MCP) server for Google Analytics 4 (GA4) that provides tools for querying GA4 data through the Admin API and Data API.
Features
Dual Authentication: Supports both OAuth Playground tokens and Service Account credentials
8 GA4 Tools:
Account and property management (Admin API)
Report execution and realtime data (Data API)
GTM → GA4 parameter validation (cross-platform orchestration)
Compatible with Claude Desktop and other MCP-enabled clients
GTM Integration: Works with GTM MCP Server for end-to-end event validation
Related MCP server: MCP Google Analytics Server
Installation
npm install
npm run buildQuick Start (OAuth Setup)
1. Create OAuth Credentials
Go to Google Cloud Console
Create a new project or select an existing one
Enable the Google Analytics Data API and Google Analytics Admin API
Go to Credentials → Create Credentials → OAuth client ID
Select Desktop app as the application type
Download or copy the Client ID and Client Secret
2. Run Setup Script
# Set your OAuth credentials
export GA4_CLIENT_ID="your-client-id.apps.googleusercontent.com"
export GA4_CLIENT_SECRET="your-client-secret"
# Run setup to authenticate with Google
npm run setupThis will:
Open a browser for Google login
Request read-only access to Google Analytics
Save tokens to
~/.ga4-mcp/tokens.json
3. Use the Server
Once authenticated, you can use the MCP server with Claude Desktop or other clients.
Authentication
The server supports two authentication methods, checked in this order:
1. OAuth Playground Tokens (Recommended for personal use)
Set these environment variables:
GA4_ACCESS_TOKEN- OAuth access tokenGA4_REFRESH_TOKEN- OAuth refresh tokenGA4_CLIENT_ID- OAuth client IDGA4_CLIENT_SECRET- OAuth client secret
Or create ~/.ga4-mcp/tokens.json:
{
"access_token": "your-access-token",
"refresh_token": "your-refresh-token",
"client_id": "your-client-id",
"client_secret": "your-client-secret"
}2. Service Account (Recommended for production)
Options (in priority order):
Set
GA4_SERVICE_ACCOUNT_JSONenvironment variable with JSON stringSet
GOOGLE_APPLICATION_CREDENTIALSto the JSON file pathPlace JSON file at
~/.ga4-mcp/credentials.jsonPlace JSON file in
./Credential/folder
Usage
Claude Desktop Configuration
Add to your Claude Desktop configuration (~/.config/claude-desktop/config.json):
{
"mcpServers": {
"ga4": {
"command": "node",
"args": ["/path/to/ga4-mcp-server/dist/index.js"],
"env": {
"GA4_ACCESS_TOKEN": "your-access-token",
"GA4_REFRESH_TOKEN": "your-refresh-token",
"GA4_CLIENT_ID": "your-client-id",
"GA4_CLIENT_SECRET": "your-client-secret"
}
}
}
}Direct Execution
# With OAuth environment variables
GA4_ACCESS_TOKEN="..." GA4_REFRESH_TOKEN="..." GA4_CLIENT_ID="..." GA4_CLIENT_SECRET="..." node dist/index.js
# With Service Account
GOOGLE_APPLICATION_CREDENTIALS="/path/to/service-account.json" node dist/index.jsAvailable Tools
Admin API Tools
Tool | Description |
| List all GA4 accounts and properties the user has access to |
| Get detailed information about a specific property |
| List Google Ads accounts linked to a property |
| List annotations for a property (limited support) |
Data API Tools
Tool | Description |
| Run a standard GA4 report with dimensions, metrics, and date ranges |
| Run a realtime report for the last 30 minutes |
| Get custom dimensions and metrics defined for a property |
GTM Validation Tool
Tool | Description |
| Validate GTM event parameters against GA4 custom dimensions and data collection |
Example Usage
Get Account Summaries
{
"tool": "ga4_account_summaries"
}Run a Report
{
"tool": "ga4_run_report",
"arguments": {
"propertyId": "123456789",
"dateRanges": [
{"startDate": "30daysAgo", "endDate": "yesterday"}
],
"dimensions": ["country", "deviceCategory"],
"metrics": ["activeUsers", "sessions"]
}
}Run Realtime Report
{
"tool": "ga4_run_realtime_report",
"arguments": {
"propertyId": "123456789",
"dimensions": ["country"],
"metrics": ["activeUsers"]
}
}Validate GTM Parameters
{
"tool": "ga4_validate_gtm_params",
"arguments": {
"propertyId": "123456789",
"gtmEvents": [
{
"eventName": "purchase",
"parameters": ["transaction_id", "value", "currency"]
}
],
"startDate": "7daysAgo",
"endDate": "yesterday"
}
}Or with GTM Export JSON:
{
"tool": "ga4_validate_gtm_params",
"arguments": {
"propertyId": "123456789",
"gtmExportJson": { "...GTM container export data..." }
}
}GTM Integration (Claude Agent Orchestration)
This server works with the GTM MCP Server to provide end-to-end validation of GTM event parameters in GA4.
Architecture
┌─────────────────────────────────────────────────────────────────────┐
│ Claude Agent │
│ (Orchestrator Role) │
├─────────────────────────────────────────────────────────────────────┤
│ │
│ ① GTM MCP Server ② GA4 MCP Server │
│ (gtmAgent/mcp-server) (ga4-mcp-server) │
│ │
│ gtm_export_full() ga4_validate_gtm_params() │
│ gtm_tag().list() ga4_custom_dimensions_metrics() │
│ │ ga4_run_report() │
│ │ ▲ │
│ └───────────────────────────────────┘ │
│ Agent relays data │
│ │
└─────────────────────────────────────────────────────────────────────┘Workflow
Extract from GTM:
gtm_export_full()→ Get GA4 Event tags and parametersValidate in GA4:
ga4_validate_gtm_params()→ Check registration and collectionGet recommendations: Parameters not registered or not collecting data
Claude Desktop Configuration (Both Servers)
{
"mcpServers": {
"gtm": {
"command": "node",
"args": ["/path/to/gtmAgent/mcp-server/dist/index.js"],
"env": {}
},
"ga4": {
"command": "node",
"args": ["/path/to/ga4-mcp-server/dist/index.js"],
"env": {
"GA4_ACCESS_TOKEN": "your-access-token",
"GA4_REFRESH_TOKEN": "your-refresh-token",
"GA4_CLIENT_ID": "your-client-id",
"GA4_CLIENT_SECRET": "your-client-secret"
}
}
}
}API Call Efficiency
Scenario | Traditional | Optimized | Reduction |
5 events × 21 params | 105 calls | 22 calls | 79% |
14 events × 32 params | 448 calls | 33 calls | 93% |
The validation tool queries metadata once, then makes one API call per unique parameter instead of per event-parameter combination.
API Documentation References
Required Google API Scopes
The server uses the following scope:
https://www.googleapis.com/auth/analytics.readonly
License
MIT
Available Tools
8 toolsga4_account_summariesA
Retrieves information about the user's Google Analytics accounts and properties. Returns a list of all GA4 accounts and their associated properties that the authenticated user has access to.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden. It discloses that this is a read operation ('Retrieves') and mentions authentication context ('authenticated user has access to'), but doesn't describe behavioral traits like pagination, rate limits, error conditions, or response format. The description adds some value but lacks comprehensive behavioral context.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two sentences that are front-loaded with the core purpose, followed by return value clarification. Zero waste - every word contributes to understanding the tool's function and scope.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given no annotations, no output schema, and a read-only operation with 0 parameters, the description is adequate but has gaps. It explains what the tool retrieves but doesn't describe the structure of returned data, potential limitations, or error handling. For a tool that returns 'a list of all GA4 accounts and their associated properties,' more detail about the response format would be helpful.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The tool has 0 parameters with 100% schema description coverage, so the baseline is 4. The description appropriately doesn't discuss parameters since none exist, and instead focuses on what the tool does and returns.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the specific verb ('Retrieves information') and resource ('Google Analytics accounts and properties'), with explicit scope ('all GA4 accounts and their associated properties that the authenticated user has access to'). It distinguishes from siblings like ga4_run_report (which runs reports) and ga4_property_details (which gets details for specific properties).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides clear context about when to use it ('to get information about GA4 accounts and properties the user can access'), but doesn't explicitly state when not to use it or name specific alternatives. For example, it doesn't contrast with ga4_property_details for getting detailed info about a specific property.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
ga4_custom_dimensions_metricsA
Retrieves the custom dimensions and metrics defined for a GA4 property. Use this to discover what custom definitions are available before running reports.
| Name | Required | Description | Default |
|---|---|---|---|
| propertyId | Yes | The Google Analytics property ID |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It describes the retrieval behavior and its purpose in a workflow, but lacks details on permissions, rate limits, or response format. This is adequate but has gaps for a tool with no annotation coverage.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is two sentences with zero waste: the first states the purpose, and the second provides usage guidance. It is appropriately sized and front-loaded, with every sentence earning its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's low complexity (1 parameter, no output schema, no annotations), the description is mostly complete for its purpose. However, it lacks details on behavioral aspects like permissions or output structure, which would be beneficial since no annotations or output schema exist.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
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 the single parameter 'propertyId'. The description does not add any meaning beyond what the schema provides, such as format examples or constraints, resulting in the baseline score of 3.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the specific action ('Retrieves') and resource ('custom dimensions and metrics defined for a GA4 property'), and distinguishes it from siblings by mentioning its role in discovery before running reports, unlike other tools that fetch summaries, links, annotations, details, or run reports.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
It explicitly states when to use this tool ('to discover what custom definitions are available before running reports'), providing clear context and distinguishing it from alternatives like ga4_run_report, which is implied as the next step after discovery.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
ga4_google_ads_linksA
Returns a list of links to Google Ads accounts for a GA4 property. Shows which Google Ads accounts are connected to the property for data sharing.
| Name | Required | Description | Default |
|---|---|---|---|
| propertyId | Yes | The Google Analytics property ID. Accepted formats: '123456789' or 'properties/123456789' |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure. It states this is a read operation ('Returns a list'), but does not mention permissions required, rate limits, pagination, or error handling. For a tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is two sentences with zero waste: the first states the purpose, and the second adds context about data sharing. It is appropriately sized and front-loaded, making it easy to understand quickly without unnecessary details.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's low complexity (single parameter, no output schema) and lack of annotations, the description is minimally adequate but incomplete. It covers the basic purpose but lacks behavioral details like response format or error cases. For a read-only tool with simple inputs, this is borderline viable but could be more informative.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
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 the propertyId parameter thoroughly. The description does not add any meaning beyond what the schema provides, such as explaining why this parameter is needed or how it relates to the output. Baseline 3 is appropriate when the schema does the heavy lifting.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the specific action ('Returns a list of links') and resource ('Google Ads accounts for a GA4 property'), and distinguishes it from siblings by focusing on account connections rather than reports, summaries, or other property details. It explicitly mentions 'data sharing' to clarify the purpose beyond just listing.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage when needing to see connected Google Ads accounts for data sharing, but does not explicitly state when to use this tool versus alternatives like ga4_property_details or other siblings. No exclusions or prerequisites are mentioned, leaving the context somewhat open-ended.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
ga4_property_annotationsB
Returns annotations for a GA4 property. Annotations are notes that mark specific dates or periods, typically used to record events like releases, campaigns, or traffic changes.
| Name | Required | Description | Default |
|---|---|---|---|
| propertyId | Yes | The Google Analytics property ID. Accepted formats: '123456789' or 'properties/123456789' |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure. It states this is a read operation ('returns'), implying it's non-destructive, but doesn't cover other aspects like authentication needs, rate limits, error handling, or response format. For a tool with zero annotation coverage, this leaves significant gaps in understanding how it behaves.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is appropriately sized and front-loaded: the first sentence states the core purpose, and the second adds useful context about annotations. Every sentence earns its place by clarifying the resource and its typical use, with no redundant or verbose language.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's low complexity (1 parameter, no output schema, no annotations), the description is minimally adequate. It explains what annotations are, which helps contextualize the return value, but lacks details on behavioral traits and usage guidelines. For a read-only tool with simple inputs, this is a baseline level of completeness.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The description adds no parameter-specific information beyond what the schema provides. With 100% schema description coverage, the schema already documents the single parameter 'propertyId' with its format details. The baseline score of 3 reflects that the schema does the heavy lifting, and the description doesn't compensate with additional context like examples or constraints.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose: 'Returns annotations for a GA4 property' with a specific verb ('returns') and resource ('annotations for a GA4 property'). It distinguishes annotations from other GA4 data by explaining they are 'notes that mark specific dates or periods' for events like releases or campaigns, though it doesn't explicitly differentiate from sibling tools like 'ga4_property_details'.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools such as 'ga4_property_details' or 'ga4_run_report', nor does it specify prerequisites, contexts, or exclusions for usage. The explanation of annotations as notes for events is helpful but doesn't translate into actionable usage instructions.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
ga4_property_detailsB
Returns details about a specific GA4 property including its name, display name, time zone, currency, industry category, and other settings.
| Name | Required | Description | Default |
|---|---|---|---|
| propertyId | Yes | The Google Analytics property ID. Accepted formats: '123456789', '123456789', or 'properties/123456789' |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries full burden. It states this is a read operation ('Returns'), but doesn't disclose behavioral traits like authentication requirements, rate limits, error handling, or response format. For a tool with zero annotation coverage, this leaves significant gaps in understanding how it behaves beyond basic functionality.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, well-structured sentence that efficiently lists key returned attributes. It's front-loaded with the core purpose and avoids unnecessary details, making every word earn its place without waste.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's low complexity (1 parameter, no output schema, no annotations), the description adequately covers the basic purpose. However, it lacks context on behavioral aspects (e.g., auth, errors) and doesn't leverage sibling tools for guidance, making it minimally complete but with clear room for improvement.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 100% description coverage, fully documenting the single parameter 'propertyId' with format details. The description adds no parameter-specific information beyond what the schema provides, so it meets the baseline of 3 for high schema coverage without compensating value.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb ('Returns') and resource ('details about a specific GA4 property'), listing specific attributes like name, display name, time zone, etc. It distinguishes from siblings by focusing on property metadata rather than reports, summaries, or other operations. However, it doesn't explicitly differentiate from 'ga4_account_summaries' which might also include property details.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives like 'ga4_account_summaries' (which might include property summaries) or 'ga4_run_report' (for data retrieval). It lacks explicit when/when-not instructions or named alternatives, leaving usage context implied at best.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
ga4_run_realtime_reportA
Runs a Google Analytics Data API realtime report. Returns real-time analytics data for the last 30 minutes.
Hints for arguments
Hints for dimensions
Use realtime dimensions from https://developers.google.com/analytics/devguides/reporting/data/v1/realtime-api-schema#dimensions Or user-scoped custom dimensions (apiName starting with "customUser:")
Hints for metrics
Use realtime metrics from https://developers.google.com/analytics/devguides/reporting/data/v1/realtime-api-schema#metrics Note: Realtime reports cannot use custom metrics.
| Name | Required | Description | Default |
|---|---|---|---|
| propertyId | Yes | The Google Analytics property ID | |
| dimensions | Yes | List of realtime dimension names (e.g., 'country', 'city', 'deviceCategory') | |
| metrics | Yes | List of realtime metric names (e.g., 'activeUsers', 'screenPageViews') | |
| dimensionFilter | No | Filter expression for dimensions | |
| metricFilter | No | Filter expression for metrics | |
| orderBys | No | List of order by specifications | |
| limit | No | Maximum number of rows to return | |
| returnPropertyQuota | No | Whether to return realtime property quota information |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool returns real-time data for the last 30 minutes and includes hints about API constraints (e.g., realtime-specific dimensions/metrics, no custom metrics), which adds useful context. However, it does not cover other behavioral aspects like authentication requirements, rate limits, error handling, or data format, leaving gaps for a mutation-like operation.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is front-loaded with the core purpose in the first sentence, followed by a structured hints section. It avoids redundancy and wastes no words, though the hints could be slightly more integrated into the main description for optimal flow.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity (8 parameters, nested objects, no output schema, and no annotations), the description provides a solid foundation with purpose, time scope, and parameter hints. However, it lacks details on output format, error cases, or integration with sibling tools, making it adequate but incomplete for full contextual understanding.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
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 all 8 parameters thoroughly. The description adds value through the hints section, which clarifies valid sources for dimensions and metrics (e.g., realtime API schema, user-scoped custom dimensions) and restrictions (no custom metrics), providing semantic context beyond the schema's technical descriptions. This justifies a baseline score of 3 with some enhancement.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the specific action ('Runs a Google Analytics Data API realtime report') and resource ('real-time analytics data for the last 30 minutes'), distinguishing it from sibling tools like 'ga4_run_report' (which presumably handles non-realtime reports) and other GA4 tools focused on metadata or configuration.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implicitly indicates usage context by specifying 'real-time analytics data for the last 30 minutes' and the hints section clarifies constraints on dimensions and metrics (e.g., 'Realtime reports cannot use custom metrics'). However, it lacks explicit guidance on when to choose this tool over alternatives like 'ga4_run_report' or other siblings.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
ga4_run_reportA
Runs a Google Analytics Data API report. Returns analytics data based on the specified dimensions, metrics, and date ranges.
Hints for arguments
Hints for dimensions
The dimensions list must consist solely of either:
Standard dimensions from https://developers.google.com/analytics/devguides/reporting/data/v1/api-schema#dimensions
Custom dimensions for the property. Use ga4_custom_dimensions_metrics to retrieve custom dimensions.
Hints for metrics
The metrics list must consist solely of either:
Standard metrics from https://developers.google.com/analytics/devguides/reporting/data/v1/api-schema#metrics
Custom metrics for the property. Use ga4_custom_dimensions_metrics to retrieve custom metrics.
Hints for dateRanges
Examples:
Single range: [{"startDate": "2025-01-01", "endDate": "2025-01-31"}]
Relative: [{"startDate": "30daysAgo", "endDate": "yesterday"}]
Multiple: [{"startDate": "2025-01-01", "endDate": "2025-01-31", "name": "Jan"}, {"startDate": "2025-02-01", "endDate": "2025-02-28", "name": "Feb"}]
Hints for dimensionFilter
Example: {"filter": {"fieldName": "eventName", "stringFilter": {"matchType": "BEGINS_WITH", "value": "page"}}}
Hints for orderBys
Example: [{"dimension": {"dimensionName": "eventName"}, "desc": false}] or [{"metric": {"metricName": "eventCount"}, "desc": true}]
| Name | Required | Description | Default |
|---|---|---|---|
| propertyId | Yes | The Google Analytics property ID. Accepted formats: '123456789' or 'properties/123456789' | |
| dateRanges | Yes | List of date ranges for the report | |
| dimensions | Yes | List of dimension names (e.g., 'eventName', 'country', 'deviceCategory') | |
| metrics | Yes | List of metric names (e.g., 'activeUsers', 'eventCount', 'sessions') | |
| dimensionFilter | No | Filter expression for dimensions | |
| metricFilter | No | Filter expression for metrics | |
| orderBys | No | List of order by specifications | |
| limit | No | Maximum number of rows to return (default: 10000, max: 250000) | |
| offset | No | Row offset for pagination (0-indexed) | |
| currencyCode | No | ISO4217 currency code (e.g., 'USD', 'EUR', 'JPY') | |
| returnPropertyQuota | No | Whether to return property quota information |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool returns analytics data, which implies a read-only operation, but doesn't explicitly confirm it's non-destructive or mention rate limits, authentication needs, or pagination behavior. The hints for arguments add some behavioral context (e.g., format requirements), but key operational details are missing.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is appropriately sized and front-loaded with the core purpose in the first sentence. The subsequent hints are well-structured into sections for different arguments, making it easy to scan. However, the hints section is lengthy and could be more concise by integrating some examples directly into the schema or reducing redundancy.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the complexity (11 parameters, nested objects, no output schema) and no annotations, the description is moderately complete. It covers the purpose, usage guidelines, and parameter semantics well, but lacks details on behavioral aspects like error handling, rate limits, or output format. Without an output schema, the description should ideally hint at the return structure, which it doesn't.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema description coverage is 100%, so the baseline is 3. The description adds significant value beyond the schema by providing detailed hints for arguments, including valid sources for dimensions and metrics (standard vs. custom), examples for dateRanges, dimensionFilter, and orderBys, and referencing sibling tools for custom data. This compensates for the schema's lack of examples and external references.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose: 'Runs a Google Analytics Data API report. Returns analytics data based on the specified dimensions, metrics, and date ranges.' It specifies the exact action (runs a report), resource (Google Analytics Data API), and distinguishes it from siblings like ga4_run_realtime_report by focusing on standard reporting rather than real-time data.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides clear context for when to use this tool by specifying it's for running reports with dimensions, metrics, and date ranges. It explicitly references ga4_custom_dimensions_metrics for retrieving custom dimensions and metrics, offering an alternative for those specific needs. However, it doesn't explicitly state when not to use it (e.g., vs. ga4_run_realtime_report for real-time data).
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
ga4_validate_gtm_paramsA
GTM에서 보내는 이벤트 파라미터가 GA4에 제대로 수집되는지 검증합니다.
사용 방법
방법 1: GTM 이벤트 목록 직접 전달
gtmEvents 배열로 이벤트별 파라미터를 전달합니다.
방법 2: GTM Container Export JSON 전달
GTM에서 컨테이너를 Export한 JSON 파일 내용을 gtmExportJson으로 전달하면 자동으로 파싱합니다.
검증 항목
파라미터가 GA4 커스텀 디멘션으로 등록되어 있는지
등록된 파라미터가 실제로 데이터를 수집하고 있는지
미등록/미수집 파라미터에 대한 권장사항
API 호출 효율성
기존: 이벤트 수 × 파라미터 수 = N×M 호출
최적화: 1(메타데이터) + 고유 파라미터 수 = 1+P 호출
| Name | Required | Description | Default |
|---|---|---|---|
| propertyId | Yes | GA4 속성 ID (예: 419573056) | |
| gtmEvents | No | GTM에서 설정한 이벤트-파라미터 목록 | |
| gtmExportJson | No | GTM Container Export JSON (gtmEvents 대신 사용 가능) | |
| startDate | No | 시작일 (기본: 7daysAgo) | |
| endDate | No | 종료일 (기본: yesterday) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes what the tool does (validation with specific checks), how it processes inputs (parsing JSON or using arrays), and performance characteristics (API call optimization from N×M to 1+P). However, it lacks details on error handling, rate limits, or authentication requirements, which are relevant for a tool interacting with GA4 APIs.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured with clear sections (purpose, usage methods, validation items, API efficiency) and uses bullet points for readability. It is appropriately sized but could be more concise by integrating the API efficiency note into the purpose section, as it slightly elongates the text without adding critical usage guidance.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the complexity (5 parameters, nested objects, no output schema, no annotations), the description is mostly complete. It covers purpose, usage methods, validation scope, and performance optimizations. However, it lacks details on output format (e.g., what the validation results look like) and error scenarios, which are important for a tool with no output schema provided.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
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 all parameters. The description adds minimal semantic value beyond the schema: it clarifies that gtmEvents and gtmExportJson are alternative methods and mentions default values for startDate/endDate. However, it doesn't explain parameter interactions or provide examples beyond what's in the schema descriptions.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose: '검증합니다' (validates) that event parameters sent from GTM are properly collected in GA4. It specifies the exact scope (GTM event parameters → GA4 collection validation) and distinguishes itself from sibling tools like ga4_run_report or ga4_custom_dimensions_metrics, which focus on reporting or metadata rather than validation.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides explicit usage guidelines under '사용 방법' (Usage Methods), detailing two alternative approaches: passing gtmEvents directly or providing gtmExportJson. It also implicitly guides when to use this tool (for validation of GTM-to-GA4 parameter collection) versus siblings (e.g., ga4_run_report for data retrieval, ga4_custom_dimensions_metrics for dimension management).
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
8 tool updates
v1.0.0- First observed
ga4_account_summaries - First observed
ga4_custom_dimensions_metrics - First observed
ga4_google_ads_links - First observed
ga4_property_annotations - First observed
ga4_property_details - First observed
ga4_run_realtime_report - First observed
ga4_run_report - First observed
ga4_validate_gtm_params
TDQS
Scored across 8 tools
Each tool has a clearly distinct purpose targeting specific GA4 resources or operations. For example, ga4_account_summaries retrieves account-level metadata, ga4_run_report handles standard analytics queries, and ga4_validate_gtm_params focuses on data quality validation. There is no functional overlap between tools, making tool selection straightforward for an agent.
All tools follow a consistent 'ga4_' prefix with descriptive snake_case naming that clearly indicates their function (e.g., ga4_property_details, ga4_run_realtime_report). The naming pattern is uniform throughout the set, making it predictable and easy to understand.
With 8 tools, this server is well-scoped for GA4 operations. It covers essential areas like metadata retrieval (accounts, properties, custom definitions), reporting (standard and realtime), and data validation, without being overwhelming or sparse. Each tool serves a clear, necessary function in the analytics workflow.
The tool set provides strong coverage for core GA4 operations including metadata access, reporting, and data validation. However, there are minor gaps such as the absence of tools for creating or managing resources (e.g., creating custom dimensions or annotations) or handling administrative tasks like user permissions, which could limit full lifecycle management.
Maintenance
Related MCP Connectors
Read and edit GA4, Search Console and Google Tag Manager from any MCP client. 29 tools.
Connect Google Analytics to ChatGPT. Query GA4 data in plain English and get instant insights.
SEO & marketing toolkit for AI agents: GA4, Search Console, AdSense, GTM, PageSpeed, Trends.
200+ read/write tools for GA4, Search Console, Google Ads, Shopify, WooCommerce, Shopware & more.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables interaction with Google Analytics APIs to fetch reports, manage properties, data streams, conversion events, and custom dimensions/metrics through OAuth2 authentication.66 npm6MIT
- AlicenseAqualityAmaintenanceEnables comprehensive integration with Google Analytics 4, allowing users to read analytics reports and send custom events through both the Data API and Measurement Protocol v2.26872 npm2MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to interact with Google Analytics 4 data, providing tools for historical reporting, real-time activity monitoring, and property management. It supports secure service account authentication to access metrics like traffic summaries, user acquisition, and custom dimensions.MIT
- AlicenseAqualityDmaintenanceEnables LLMs to interact with Google Analytics via Admin and Data APIs, allowing users to retrieve account summaries, run reports, and analyze realtime data.6Apache 2.0