Skip to main content
Glama

Google Ads & Meta Ads

Tag Manager: Create Trigger

gtm_create_trigger

Create one trigger in a draft workspace of a Google Tag Manager container: a page view, DOM ready, window loaded, click, link click, form submit, custom event or history change trigger, with conditions such as Page URL contains /thank-you, and for a custom event its event name. The trigger fires nothing until a tag uses it (gtm_create_tag, gtm_update_tag). Saved in the existing workspace the user names (ask which) and NOT published: the user reviews and publishes in Tag Manager. Requires editing to be enabled on the Tag Manager connection.

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": {
      "workspace": "<workspace>",
      "name": "<name>",
      "type": "<type>"
    },
    "name": "gtm_create_trigger"
  }
}

Input Schema

NameRequiredDescriptionDefault
nameYesThe trigger's name, unique in the container, e.g. "Thank you page".
typeYesKind of trigger: PAGEVIEW, DOM_READY, WINDOW_LOADED, CLICK (any element), LINK_CLICK, FORM_SUBMIT, CUSTOM_EVENT (a dataLayer event) or HISTORY_CHANGE.
notesNoNotes shown on the trigger in Tag Manager. Optional.
containerNoThe container: its public id (GTM-XXXXXXX), its name, or its API path from gtm_list_containers. May be left out when the connected login reaches exactly one container.
workspaceYesThe existing Tag Manager workspace to save the draft in, by name or id, as the user named it (gtm_list_workspaces). Ask the user which workspace to use; never pick one yourself. Nothing is published.
conditionsNoConditions that must all hold for the trigger to fire; empty or omitted means every event of the type (every page view, every click). Each compares a variable with a value. At most 20. Built-in variables like Click Classes or Page Path must be enabled in the container to be used.
event_nameNoCUSTOM_EVENT: the dataLayer event name that fires it, e.g. purchase or form_submitted.
event_name_regexNoCUSTOM_EVENT: treat event_name as a regular expression (e.g. ^(purchase|refund)$). Default false.

Output Schema

NameRequiredDescriptionDefault
kindYesPAGEVIEW, CLICK, CUSTOM_EVENT, …
nameYesThe trigger's name.
typeYesGoogle's type code, e.g. pageview or customEvent.
publicIdNoPublic GTM-XXXXXXX id of the container.
publishedYesAlways false: the change is a draft until a version is created and published.
triggerIdYesId of the new trigger inside the container.
conditionsYesIts conditions as "{{Page URL}} contains /thanks" lines; the custom event name is one of them.
workspaceIdYesId of the workspace the change was saved in.
workspaceUrlYesWhere the user reviews, previews and publishes the workspace in Tag Manager.
containerNameYesThe container's name.
containerPathYesAPI path of the container, accounts/{a}/containers/{c}.
workspaceNameYesName of that workspace.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.3/5.0
Behavior5/5

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

Annotations only say it is a non-readonly, non-destructive, open-world, non-idempotent write. The description adds genuinely new behavioral facts: the result lands in an existing draft workspace and is NOT published, the user must review and publish in Tag Manager, editing must be enabled on the connection, and the trigger has no effect until a tag uses it.

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-loads the action and resource, then layers constraints (workspace choice, draft-only, permission prerequisite) in a compact paragraph with almost no filler. It is dense but every clause carries operational meaning; only the trigger-type enumeration slightly duplicates the schema enum.

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?

Given an output schema, rich annotations, and full schema coverage, the description supplies the missing operational context an agent needs: draft scope, permission prerequisite, and the tag-linkage caveat. Minor remaining gap is that it does not mention duplicate-name behavior (the schema notes names are unique in the container) or how the created trigger is reused downstream.

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 description coverage is 100%, so the schema already documents all eight parameters, including the type enum and the conditions sub-fields. The description restates a few of those semantics (condition example "Page URL contains /thank-you", custom event name) without adding syntax, limits, or defaults beyond the schema — hence the baseline 3.

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?

Opens with a specific verb+resource ("Create one trigger in a draft workspace of a Google Tag Manager container") and then enumerates the trigger kinds and condition shape, so the agent knows exactly what will be produced. It is clearly distinguishable from gtm_create_tag and gtm_update_trigger, which are named in the body.

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 usage context: ask the user which existing workspace, editing must be enabled on the connection, and the trigger is inert until a tag references it (pointing at gtm_create_tag/gtm_update_tag). It does not explicitly say when to prefer gtm_update_trigger over creating a new trigger, which is the one routing decision left to inference.

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