Skip to main content
Glama
HappyMonkeyAI

ai-google-analytics-mcp

scaffold_ga4_nextjs_tracking

Set up Google Analytics 4 for a Next.js app by writing GoogleAnalytics.tsx, wiring layout.tsx, and configuring the measurement ID in .env.local.

Instructions

Scaffold GA4 for a Next.js app: write GoogleAnalytics.tsx, wire layout.tsx, and set NEXT_PUBLIC_GA_MEASUREMENT_ID in .env.local (when mode=env). web_root must be the Next.js package root (directory containing package.json).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modeNoenv
dry_runNo
web_rootYes
consent_gatedNo
measurement_idYes
layout_relativeNosrc/app/layout.tsx

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior3/5

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

Description discloses that it writes GoogleAnalytics.tsx, modifies layout.tsx, and sets .env.local when mode=env. However, it does not state whether files are overwritten, if the operation is idempotent, or any side effects. With no annotations, the description partially covers behavioral traits.

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?

Two sentences with no redundancy. Directly states the action and a critical constraint. All words serve a purpose.

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 6 parameters, 0% schema descriptions, and no annotations, the description lacks detail on parameter semantics and behavioral completeness. It does not explain behavior on conflict, authentication needs, or output structure despite having an output schema. The tool modifies files, but the description omits important context like error handling.

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 has 0% description coverage, so description must explain all parameters. It only explains web_root and partially measurement_id and mode. Parameters dry_run, consent_gated, and layout_relative are not mentioned at all, leaving 4 out of 6 parameters undocumented in the description.

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?

Description clearly identifies the tool as scaffolding GA4 for a Next.js app, specifying files to write and env variable. However, it does not differentiate from sibling tools like render_ga4_nextjs_component or inject_ga4_gtag_into_file, which also handle similar tasks.

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

Usage Guidelines2/5

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

Only implicit guidance is provided: web_root must be the Next.js package root. No explicit when-to-use or when-not-to-use compared to siblings, and no mention of prerequisites like having a Next.js project already set up.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/HappyMonkeyAI/ai-google-analytics-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server