Skip to main content
Glama
mcp-google-analytics

mcp-google-analytics

Install gtag in existing HTML

site_inject_tracking

Idempotently injects or refreshes the gtag snippet in every HTML file in a folder or a single file, skipping files with other measurement IDs unless replacement is enabled.

Instructions

Adds or refreshes the gtag snippet in every .html file of a folder (or a single file). Idempotent. Files that already carry another measurement ID are skipped unless replaceForeignTags=true.

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": {
      "target": "<target>",
      "measurementId": "<measurementId>"
    },
    "name": "site_inject_tracking"
  }
}

Input Schema

NameRequiredDescriptionDefault
targetYesFolder or .html file.
measurementIdYes
replaceForeignTagsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.6/5.0
Behavior4/5

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

With no annotations, the description carries the burden and does disclose the key traits: it writes into files, is idempotent, and has a skip rule for foreign measurement IDs with an explicit override. It omits what happens to modified files beyond the injection (backups, in-place overwrite, failure handling), which matters for a write tool.

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?

Three tight sentences with the core action front-loaded and the exception rule placed last. No filler, though the idempotency and skip clauses could be merged for tighter reading.

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

Completeness3/5

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

For a file-mutating tool with no annotations and no output schema, the description covers scope and skip behavior but leaves out return information (which files were touched or skipped) and side-effect details an agent needs before invoking it on a folder.

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

Parameters3/5

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

Schema coverage is 33%: only 'target' is documented in the schema. The description explains the semantics of replaceForeignTags (toggles skipping of foreign tags) but adds nothing about measurementId format or validation. It compensates for one of the two undocumented parameters, so it sits at a solid but incomplete 3.

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?

A concrete verb+resource ('Adds or refreshes the gtag snippet') with explicit scope ('every .html file of a folder (or a single file)'). It does not name or contrast with siblings such as site_verify_tracking or ga_get_tracking_snippet, though the mutation semantics make it distinguishable.

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

Usage Guidelines3/5

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

Usage is implied by the injection verb, and it gives one clear guardrail ('Files that already carry another measurement ID are skipped unless replaceForeignTags=true'). It never states when to prefer this over retrieving a snippet or verifying tracking, nor any prerequisites (auth, folder permissions).

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