Skip to main content
Glama

Optimize an existing Google tag snippet

optimize-google-tag
Read-onlyIdempotent

Rebuild GA4 gtag.js markup from a G- measurement ID. Use on existing GA4 snippets, not GTM containers or consent setup. Returns replacement HTML with async loading and a config call, or original input if no G- ID exists. Review lost settings and consent.

Input Schema

NameRequiredDescriptionDefault
htmlYesExisting HTML snippet containing the Google Analytics tag to optimize.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.5/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true, destructiveHint=false, and idempotentHint=true, so the safety profile is clear. The description adds valuable context about the return value ('replacement HTML with async loading and a config call, or original input if no G- ID exists') and warns about lost settings and consent review, going beyond what annotations provide.

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 three tightly written sentences, front-loaded with the core action and followed by usage constraints and return behavior. Every sentence contributes necessary information without redundancy.

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 single-parameter transformation tool with no output schema, the description covers the essential behavior: what it rebuilds, when to use it, what it returns, and what to watch out for (lost settings, consent). Combined with annotations and the input schema, an agent has everything needed to call it correctly.

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 100% and the single parameter 'html' is fully described in the schema. The description does not add any additional meaning about the parameter beyond what the schema already states, so the baseline score of 3 is appropriate.

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 states a specific verb ('Rebuild') and resource ('GA4 gtag.js markup') and explicitly distinguishes the tool from GTM containers and consent setup. An agent can immediately understand what the tool does and what it does not handle.

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

Usage Guidelines5/5

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

The description gives explicit usage guidance: 'Use on existing GA4 snippets, not GTM containers or consent setup.' This tells the agent both when to use the tool and when to avoid it, and the caveat 'Review lost settings and consent' adds a clear post-use check.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources