Skip to main content
Glama
google-data-mcp

google-data-mcp

by seliem-attia

GTM: Create or change tag/trigger/variable

gtm_save_entity

Creates a new GTM entity or fully replaces an existing tag, trigger, or variable in a workspace. Include the fingerprint on updates to prevent overwriting concurrent changes.

Instructions

Without entityId: creates the entity (POST). With entityId: replaces it completely (PUT) — fetch it first via gtm_list_entities, change it and send it back in full; if entity.fingerprint is included, GTM aborts if it was changed in the meantime. Example GA4 event tag: {"name":"GA4 – generate_lead","type":"gaawe","parameter":[{"type":"template","key":"eventName","value":"generate_lead"},{"type":"template","key":"measurementIdOverride","value":"G-XXXX"}],"firingTriggerId":["12"]}. Pre-check: JavaScript in Custom HTML tags and Custom JS variables must be ES5 strict (no let/const/arrow, no function declaration in try/if/for), every {{Variable}} must exist in the workspace.

Input Schema

NameRequiredDescriptionDefault
entityYesGTM resource in API format (tag, trigger, variable …)
entityIdNoID of the existing entity (tagId/triggerId/variableId …) → update
accountIdYesGTM accountId (from gtm_list_accounts)
entityTypeYesEntity type: tags, triggers, variables, folders, templates, clients, transformations, zones
containerIdYesGTM containerId, numeric
workspaceIdYesWorkspace ID (from gtm_list_workspaces / gtm_create_workspace)
skipValidationNoSkip the pre-check — only for a proven false positive

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.6.1

TDQS

A4.5/5.0
Behavior5/5

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

Goes well beyond the annotations: discloses that including entity.fingerprint makes GTM abort on concurrent modification, that the PUT path replaces rather than merges, and that a pre-check enforces ES5-strict JS and resolution of every {{Variable}}. The full-replace semantics sit in mild tension with destructiveHint=false, but since no entity is deleted this reads as scope clarification rather than a contradiction.

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?

Front-loaded with the create-versus-replace decision, then concurrency, then an example, then pre-checks — a sensible escalation of detail. It is dense and the pre-check sentence packs several rules into one line, but no sentence is filler.

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

Completeness4/5

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

For a nested, 7-parameter mutation with no output schema, the description covers modes, concurrency, payload format, and validation traps. The remaining gap is that it never indicates what comes back (e.g., the saved entity and its new fingerprint), which an agent needs to chain a follow-up call.

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 100%, so the baseline is 3; the description still adds real meaning by explaining that entityId switches POST to PUT, that fingerprint belongs inside entity, and by showing the concrete tag payload shape (type, parameter key/value, firingTriggerId). It does not elaborate on entityType beyond the enum already in the schema.

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?

States a specific verb (create or replace) and resource (GTM entity: tag/trigger/variable), and the very first clause disambiguates the two modes by presence of entityId. An agent can distinguish this from gtm_list_entities, gtm_delete_entity, and gtm_revert_entity without opening any schema.

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?

Gives concrete workflow guidance: fetch first via gtm_list_entities, mutate in full, send back, and only skipValidation for a proven false positive. It does not say when to use this versus siblings like gtm_revert_entity or gtm_resolve_conflict for correcting an existing entity, which is the one routing gap.

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