Skip to main content
Glama
Samarth GTM MCP Server

Samarth GTM MCP Server

Official

triggers_create

Create a GTM trigger in a workspace to define when tags fire, such as clicks, pageviews, custom events, scrolls, or timers. Requires writes enabled and confirm=true.

Instructions

[WRITE] Create a GTM trigger. Requires GTM_MCP_ENABLE_WRITES=true and confirm=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": {
      "accountId": "<accountId>",
      "containerId": "<containerId>",
      "workspaceId": "<workspaceId>",
      "name": "<name>",
      "type": "<type>",
      "confirm": "<confirm>"
    },
    "name": "triggers_create"
  }
}

Input Schema

NameRequiredDescriptionDefault
nameYesTrigger name.
typeYesTrigger type (e.g. "click", "pageview", "customEvent", "domReady", "windowLoaded", "historyChange", "jsError", "scrollDepth", "elementVisibility", "timer", "youTubeVideo", "formSubmission", "linkClick").
limitNoTimer trigger: max number of times the timer fires, as a single Parameter {type:"template", value:"3"} (no key). Dedicated TOP-LEVEL GTM field — do NOT put it in `parameter`.
notesNo
filterNoConditions that must be met for the trigger to fire ("fires on SOME …").
confirmYes
intervalNoTimer trigger: firing interval in MILLISECONDS as a single Parameter {type:"template", value:"5000"} (no key). This is a dedicated TOP-LEVEL GTM field — do NOT put it in `parameter`.
accountIdYes
eventNameNoTIMER triggers ONLY: the name of the GTM event the timer fires, as a single Parameter {type:"template", value:"gtm.timer"} (no key). Defaults to gtm.timer when omitted. Do NOT send this for a customEvent trigger: GTM rejects it. A customEvent trigger carries its name in `customEventFilter` as EXACTLY ONE condition, {{_event}} equals <name>, e.g. [{"type":"equals","parameter":[{"type":"template","key":"arg0","value":"{{_event}}"},{"type":"template","key":"arg1","value":"purchase"}]}]. Any further scoping goes in `filter`.
parameterNoTrigger settings as a parameter list — e.g. a YouTube Video trigger's captureStart/progressThresholdsPercent, scroll thresholds, element-visibility selector. NOTE: a timer's interval/limit are the separate top-level `interval`/`limit` fields, NOT here.
containerIdYes
waitForTagsNoForm/link trigger: send a plain boolean (true/false). A Parameter {type:"boolean", value:"true"} is also accepted.
workspaceIdYes
parentFolderIdNo
autoEventFilterNoConditions for auto-event triggers (legacy; most scopes use `filter`).
checkValidationNoForm/link trigger: send a plain boolean (true/false). A Parameter object is also accepted.
intervalSecondsNoTimer trigger: firing interval in SECONDS as a single Parameter (no key). Top-level GTM field. Use interval (ms) OR intervalSeconds, not both.
customEventFilterNoUsed for custom event triggers.
waitForTagsTimeoutNoForm/link trigger: timeout in milliseconds. Send a plain number (e.g. 2000). A Parameter object is also accepted.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed35 schema fields changedv1.497.5
    • removedInput schema / additionalProperties
      Removed value: -false
    • addedInput schema / definitions
      Added value: +{
      +  "__schema0": {
      +    "properties": {
      +      "key": {
      +        "description": "Parameter key/name (omit for entries inside a list).",
      +        "type": "string"
      +      },
      +      "list": {
      +        "description": "Child parameters when type=\"list\".",
      +        "items": {
      +          "$ref": "#/definitions/__schema0"
      +        },
      +        "type": "array"
      +      },
      +      "map": {
      +        "description": "Child parameters when type=\"map\".",
      +        "items": {
      +          "$ref": "#/definitions/__schema0"
      +        },
      +        "type": "array"
      +      },
      +      "type": {
      +        "description": "template | integer | boolean | list | map | tagReference | triggerReference | template",
      +        "type": "string"
      +      },
      +      "value": {
      +        "description": "Scalar value (template/integer/boolean/reference). May be a GTM variable like {{Click Text}}.",
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "type"
      +    ],
      +    "type": "object"
      +  }
      +}
    • addedInput schema / properties / accountId / pattern
      Added value: +"^\\d+$"
    • removedInput schema / properties / autoEventFilter / $ref
      Removed value: -"#/properties/filter"
    • addedInput schema / properties / autoEventFilter / items
      Added value: +{
      +  "properties": {
      +    "parameter": {
      +      "description": "EXACTLY TWO entries, keyed arg0 then arg1. Example, a link click on a mailto: address: [{\"type\":\"template\",\"key\":\"arg0\",\"value\":\"{{Click URL}}\"},{\"type\":\"template\",\"key\":\"arg1\",\"value\":\"mailto:\"}] with condition type \"contains\".",
      +      "items": {
      +        "properties": {
      +          "key": {
      +            "description": "MUST be \"arg0\" or \"arg1\" — GTM accepts no other key here, and anything else fails with \"Parameter key is unknown\". arg0 is the LEFT side (the variable being tested), arg1 is the RIGHT side (the value compared against).",
      +            "type": "string"
      +          },
      +          "type": {
      +            "description": "Almost always \"template\".",
      +            "type": "string"
      +          },
      +          "value": {
      +            "description": "For arg0, a variable reference in double braces, e.g. \"{{Click URL}}\", \"{{_event}}\", \"{{Page Path}}\". For arg1, the literal to compare, e.g. \"mailto:\". A built-in variable referenced in arg0 must be ENABLED in the workspace first — see built_in_variables_enable (Click URL is \"clickUrl\", Click Text \"clickText\", Form ID \"formId\", and so on).",
      +            "type": "string"
      +          }
      +        },
      +        "required": [
      +          "type"
      +        ],
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "type": {
      +      "description": "Condition type: contains, cssSelector, endsWith, equals, greater, greaterOrEquals, less, lessOrEquals, matchRegex, startsWith, urlMatches.",
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "type",
      +    "parameter"
      +  ],
      +  "type": "object"
      +}
    • addedInput schema / properties / autoEventFilter / type
      Added value: +"array"
    • changedInput schema / properties / checkValidation / anyOf
      Previous value: -[
      -  {
      -    "type": "boolean"
      -  },
      -  {
      -    "type": "number"
      -  },
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "$ref": "#/properties/eventName"
      -  }
      -]New value: +[
      +  {
      +    "type": "boolean"
      +  },
      +  {
      +    "type": "number"
      +  },
      +  {
      +    "type": "string"
      +  },
      +  {
      +    "properties": {
      +      "key": {
      +        "type": "string"
      +      },
      +      "type": {
      +        "type": "string"
      +      },
      +      "value": {
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "type"
      +    ],
      +    "type": "object"
      +  }
      +]
    • addedInput schema / properties / containerId / pattern
      Added value: +"^\\d+$"
    • removedInput schema / properties / customEventFilter / $ref
      Removed value: -"#/properties/filter"
    • addedInput schema / properties / customEventFilter / items
      Added value: +{
      +  "properties": {
      +    "parameter": {
      +      "description": "EXACTLY TWO entries, keyed arg0 then arg1. Example, a link click on a mailto: address: [{\"type\":\"template\",\"key\":\"arg0\",\"value\":\"{{Click URL}}\"},{\"type\":\"template\",\"key\":\"arg1\",\"value\":\"mailto:\"}] with condition type \"contains\".",
      +      "items": {
      +        "properties": {
      +          "key": {
      +            "description": "MUST be \"arg0\" or \"arg1\" — GTM accepts no other key here, and anything else fails with \"Parameter key is unknown\". arg0 is the LEFT side (the variable being tested), arg1 is the RIGHT side (the value compared against).",
      +            "type": "string"
      +          },
      +          "type": {
      +            "description": "Almost always \"template\".",
      +            "type": "string"
      +          },
      +          "value": {
      +            "description": "For arg0, a variable reference in double braces, e.g. \"{{Click URL}}\", \"{{_event}}\", \"{{Page Path}}\". For arg1, the literal to compare, e.g. \"mailto:\". A built-in variable referenced in arg0 must be ENABLED in the workspace first — see built_in_variables_enable (Click URL is \"clickUrl\", Click Text \"clickText\", Form ID \"formId\", and so on).",
      +            "type": "string"
      +          }
      +        },
      +        "required": [
      +          "type"
      +        ],
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "type": {
      +      "description": "Condition type: contains, cssSelector, endsWith, equals, greater, greaterOrEquals, less, lessOrEquals, matchRegex, startsWith, urlMatches.",
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "type",
      +    "parameter"
      +  ],
      +  "type": "object"
      +}
    • addedInput schema / properties / customEventFilter / type
      Added value: +"array"
    • removedInput schema / properties / eventName / additionalProperties
      Removed value: -false
    • changedInput schema / properties / eventName / description
      Previous value: -"Custom event name (for customEvent type)."New value: +"TIMER triggers ONLY: the name of the GTM event the timer fires, as a single Parameter {type:\"template\", value:\"gtm.timer\"} (no key). Defaults to gtm.timer when omitted. Do NOT send this for a customEvent trigger: GTM rejects it. A customEvent trigger carries its name in `customEventFilter` as EXACTLY ONE condition, {{_event}} equals <name>, e.g. [{\"type\":\"equals\",\"parameter\":[{\"type\":\"template\",\"key\":\"arg0\",\"value\":\"{{_event}}\"},{\"type\":\"template\",\"key\":\"arg1\",\"value\":\"purchase\"}]}]. Any further scoping goes in `filter`."
    • removedInput schema / properties / filter / items / additionalProperties
      Removed value: -false
    • removedInput schema / properties / filter / items / properties / parameter / items / additionalProperties
      Removed value: -false
    • removedInput schema / properties / interval / $ref
      Removed value: -"#/properties/eventName"
    • addedInput schema / properties / interval / properties
      Added value: +{
      +  "key": {
      +    "type": "string"
      +  },
      +  "type": {
      +    "type": "string"
      +  },
      +  "value": {
      +    "type": "string"
      +  }
      +}
    • addedInput schema / properties / interval / required
      Added value: +[
      +  "type"
      +]
    • addedInput schema / properties / interval / type
      Added value: +"object"
    • removedInput schema / properties / intervalSeconds / $ref
      Removed value: -"#/properties/eventName"
    • addedInput schema / properties / intervalSeconds / properties
      Added value: +{
      +  "key": {
      +    "type": "string"
      +  },
      +  "type": {
      +    "type": "string"
      +  },
      +  "value": {
      +    "type": "string"
      +  }
      +}
    • addedInput schema / properties / intervalSeconds / required
      Added value: +[
      +  "type"
      +]
    • addedInput schema / properties / intervalSeconds / type
      Added value: +"object"
    • removedInput schema / properties / limit / $ref
      Removed value: -"#/properties/eventName"
    • addedInput schema / properties / limit / properties
      Added value: +{
      +  "key": {
      +    "type": "string"
      +  },
      +  "type": {
      +    "type": "string"
      +  },
      +  "value": {
      +    "type": "string"
      +  }
      +}
    • addedInput schema / properties / limit / required
      Added value: +[
      +  "type"
      +]
    • addedInput schema / properties / limit / type
      Added value: +"object"
    • addedInput schema / properties / parameter / items / $ref
      Added value: +"#/definitions/__schema0"
    • removedInput schema / properties / parameter / items / additionalProperties
      Removed value: -false
    • removedInput schema / properties / parameter / items / properties
      Removed value: -{
      -  "key": {
      -    "description": "Parameter key/name (omit for entries inside a list).",
      -    "type": "string"
      -  },
      -  "list": {
      -    "description": "Child parameters when type=\"list\".",
      -    "items": {
      -      "$ref": "#/properties/parameter/items"
      -    },
      -    "type": "array"
      -  },
      -  "map": {
      -    "description": "Child parameters when type=\"map\".",
      -    "items": {
      -      "$ref": "#/properties/parameter/items"
      -    },
      -    "type": "array"
      -  },
      -  "type": {
      -    "description": "template | integer | boolean | list | map | tagReference | triggerReference | template",
      -    "type": "string"
      -  },
      -  "value": {
      -    "description": "Scalar value (template/integer/boolean/reference). May be a GTM variable like {{Click Text}}.",
      -    "type": "string"
      -  }
      -}
    • removedInput schema / properties / parameter / items / required
      Removed value: -[
      -  "type"
      -]
    • removedInput schema / properties / parameter / items / type
      Removed value: -"object"
    • changedInput schema / properties / waitForTags / anyOf
      Previous value: -[
      -  {
      -    "type": "boolean"
      -  },
      -  {
      -    "type": "number"
      -  },
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "$ref": "#/properties/eventName"
      -  }
      -]New value: +[
      +  {
      +    "type": "boolean"
      +  },
      +  {
      +    "type": "number"
      +  },
      +  {
      +    "type": "string"
      +  },
      +  {
      +    "properties": {
      +      "key": {
      +        "type": "string"
      +      },
      +      "type": {
      +        "type": "string"
      +      },
      +      "value": {
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "type"
      +    ],
      +    "type": "object"
      +  }
      +]
    • changedInput schema / properties / waitForTagsTimeout / anyOf
      Previous value: -[
      -  {
      -    "type": "boolean"
      -  },
      -  {
      -    "type": "number"
      -  },
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "$ref": "#/properties/eventName"
      -  }
      -]New value: +[
      +  {
      +    "type": "boolean"
      +  },
      +  {
      +    "type": "number"
      +  },
      +  {
      +    "type": "string"
      +  },
      +  {
      +    "properties": {
      +      "key": {
      +        "type": "string"
      +      },
      +      "type": {
      +        "type": "string"
      +      },
      +      "value": {
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "type"
      +    ],
      +    "type": "object"
      +  }
      +]
    • addedInput schema / properties / workspaceId / pattern
      Added value: +"^\\d+$"
  2. Changed13 schema fields changedv1.473.4
    • removedInput schema / properties / checkValidation / $ref
      Removed value: -"#/properties/eventName"
    • addedInput schema / properties / checkValidation / anyOf
      Added value: +[
      +  {
      +    "type": "boolean"
      +  },
      +  {
      +    "type": "number"
      +  },
      +  {
      +    "type": "string"
      +  },
      +  {
      +    "$ref": "#/properties/eventName"
      +  }
      +]
    • changedInput schema / properties / checkValidation / description
      Previous value: -"Form/link trigger: a single boolean Parameter (no key)."New value: +"Form/link trigger: send a plain boolean (true/false). A Parameter object is also accepted."
    • addedInput schema / properties / filter / items / properties / parameter / description
      Added value: +"EXACTLY TWO entries, keyed arg0 then arg1. Example, a link click on a mailto: address: [{\"type\":\"template\",\"key\":\"arg0\",\"value\":\"{{Click URL}}\"},{\"type\":\"template\",\"key\":\"arg1\",\"value\":\"mailto:\"}] with condition type \"contains\"."
    • addedInput schema / properties / filter / items / properties / parameter / items / properties / key / description
      Added value: +"MUST be \"arg0\" or \"arg1\" — GTM accepts no other key here, and anything else fails with \"Parameter key is unknown\". arg0 is the LEFT side (the variable being tested), arg1 is the RIGHT side (the value compared against)."
    • addedInput schema / properties / filter / items / properties / parameter / items / properties / type / description
      Added value: +"Almost always \"template\"."
    • addedInput schema / properties / filter / items / properties / parameter / items / properties / value / description
      Added value: +"For arg0, a variable reference in double braces, e.g. \"{{Click URL}}\", \"{{_event}}\", \"{{Page Path}}\". For arg1, the literal to compare, e.g. \"mailto:\". A built-in variable referenced in arg0 must be ENABLED in the workspace first — see built_in_variables_enable (Click URL is \"clickUrl\", Click Text \"clickText\", Form ID \"formId\", and so on)."
    • removedInput schema / properties / waitForTags / $ref
      Removed value: -"#/properties/eventName"
    • addedInput schema / properties / waitForTags / anyOf
      Added value: +[
      +  {
      +    "type": "boolean"
      +  },
      +  {
      +    "type": "number"
      +  },
      +  {
      +    "type": "string"
      +  },
      +  {
      +    "$ref": "#/properties/eventName"
      +  }
      +]
    • changedInput schema / properties / waitForTags / description
      Previous value: -"Form/link trigger: a single boolean Parameter {type:\"boolean\", value:\"true|false\"} (no key)."New value: +"Form/link trigger: send a plain boolean (true/false). A Parameter {type:\"boolean\", value:\"true\"} is also accepted."
    • removedInput schema / properties / waitForTagsTimeout / $ref
      Removed value: -"#/properties/eventName"
    • addedInput schema / properties / waitForTagsTimeout / anyOf
      Added value: +[
      +  {
      +    "type": "boolean"
      +  },
      +  {
      +    "type": "number"
      +  },
      +  {
      +    "type": "string"
      +  },
      +  {
      +    "$ref": "#/properties/eventName"
      +  }
      +]
    • changedInput schema / properties / waitForTagsTimeout / description
      Previous value: -"Form/link trigger: a single template Parameter with the timeout ms."New value: +"Form/link trigger: timeout in milliseconds. Send a plain number (e.g. 2000). A Parameter object is also accepted."
  3. Changed4 schema fields changedv1.263.0
    • addedInput schema / properties / interval
      Added value: +{
      +  "$ref": "#/properties/eventName",
      +  "description": "Timer trigger: firing interval in MILLISECONDS as a single Parameter {type:\"template\", value:\"5000\"} (no key). This is a dedicated TOP-LEVEL GTM field — do NOT put it in `parameter`."
      +}
    • addedInput schema / properties / intervalSeconds
      Added value: +{
      +  "$ref": "#/properties/eventName",
      +  "description": "Timer trigger: firing interval in SECONDS as a single Parameter (no key). Top-level GTM field. Use interval (ms) OR intervalSeconds, not both."
      +}
    • addedInput schema / properties / limit
      Added value: +{
      +  "$ref": "#/properties/eventName",
      +  "description": "Timer trigger: max number of times the timer fires, as a single Parameter {type:\"template\", value:\"3\"} (no key). Dedicated TOP-LEVEL GTM field — do NOT put it in `parameter`."
      +}
    • changedInput schema / properties / parameter / description
      Previous value: -"Trigger settings as a parameter list — e.g. a YouTube Video trigger's captureStart/progressThresholdsPercent, a timer's interval/limit, scroll thresholds, element-visibility selector."New value: +"Trigger settings as a parameter list — e.g. a YouTube Video trigger's captureStart/progressThresholdsPercent, scroll thresholds, element-visibility selector. NOTE: a timer's interval/limit are the separate top-level `interval`/`limit` fields, NOT here."
  4. Changed6 schema fields changedv1.35.1
    • addedInput schema / properties / autoEventFilter
      Added value: +{
      +  "$ref": "#/properties/filter",
      +  "description": "Conditions for auto-event triggers (legacy; most scopes use `filter`)."
      +}
    • addedInput schema / properties / checkValidation
      Added value: +{
      +  "$ref": "#/properties/eventName",
      +  "description": "Form/link trigger: a single boolean Parameter (no key)."
      +}
    • changedInput schema / properties / filter / description
      Previous value: -"Conditions that must be met for the trigger to fire."New value: +"Conditions that must be met for the trigger to fire (\"fires on SOME …\")."
    • addedInput schema / properties / parameter
      Added value: +{
      +  "description": "Trigger settings as a parameter list — e.g. a YouTube Video trigger's captureStart/progressThresholdsPercent, a timer's interval/limit, scroll thresholds, element-visibility selector.",
      +  "items": {
      +    "additionalProperties": false,
      +    "properties": {
      +      "key": {
      +        "description": "Parameter key/name (omit for entries inside a list).",
      +        "type": "string"
      +      },
      +      "list": {
      +        "description": "Child parameters when type=\"list\".",
      +        "items": {
      +          "$ref": "#/properties/parameter/items"
      +        },
      +        "type": "array"
      +      },
      +      "map": {
      +        "description": "Child parameters when type=\"map\".",
      +        "items": {
      +          "$ref": "#/properties/parameter/items"
      +        },
      +        "type": "array"
      +      },
      +      "type": {
      +        "description": "template | integer | boolean | list | map | tagReference | triggerReference | template",
      +        "type": "string"
      +      },
      +      "value": {
      +        "description": "Scalar value (template/integer/boolean/reference). May be a GTM variable like {{Click Text}}.",
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "type"
      +    ],
      +    "type": "object"
      +  },
      +  "type": "array"
      +}
    • addedInput schema / properties / waitForTags
      Added value: +{
      +  "$ref": "#/properties/eventName",
      +  "description": "Form/link trigger: a single boolean Parameter {type:\"boolean\", value:\"true|false\"} (no key)."
      +}
    • addedInput schema / properties / waitForTagsTimeout
      Added value: +{
      +  "$ref": "#/properties/eventName",
      +  "description": "Form/link trigger: a single template Parameter with the timeout ms."
      +}
  5. First observedv1.0.0

TDQS

B3.4/5.0
Behavior3/5

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

No annotations are supplied, but the description discloses the two write gates (environment flag and confirm flag), which is real behavioral context beyond the schema. It stops short of saying what the tool returns, whether an identical trigger causes a failure, or whether the trigger is created in a draft state requiring a separate publish step.

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?

Two short sentences with the mutation marker front-loaded and nothing redundant. The brevity is appropriate for the format, though it reads as under-specification rather than disciplined concision.

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 19-parameter nested mutation tool with no annotations and no output schema, the description covers only the invocation gates. It never explains that required fields vary by trigger type or how the caller should interpret the response, leaving the agent to mine the schema for the difficult parts.

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?

The description contributes nothing about any of the 19 parameters. Schema coverage sits at 68% but the nested descriptions are unusually dense (arg0/arg1 rules, timer interval/limit as top-level fields, customEventFilter shape), so the schema largely carries the burden and a baseline 3 is defensible rather than a 2.

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?

States a specific verb and resource: 'Create a GTM trigger', and the '[WRITE]' tag signals mutation immediately. It does not contrast itself with siblings such as triggers_update or triggers_list, but the name plus verb make the CRUD role unambiguous.

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?

Gives hard preconditions for invocation (GTM_MCP_ENABLE_WRITES=true and confirm=true), which is genuinely useful gating information. However, it offers no guidance on when to create a new trigger versus updating an existing one, and no mention that the target workspace/container must already exist.

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

Deploy Server

Other Tools