Skip to main content
Glama
Samarth GTM MCP Server

Samarth GTM MCP Server

Official

variables_update

Update a Google Tag Manager variable with a read-modify-write flow that preserves omitted fields and merges parameter entries by key.

Instructions

[WRITE] Update a GTM variable (read-modify-write — omitted fields are preserved; parameter is merged by key). 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>",
      "variableId": "<variableId>",
      "confirm": "<confirm>"
    },
    "name": "variables_update"
  }
}

Input Schema

NameRequiredDescriptionDefault
nameNo
typeNo
notesNo
confirmYes
accountIdYes
parameterNoGTM parameter list — supports NESTED list/map params. Example (a GA4 event parameter table): [{"type":"list","key":"eventSettingsTable","list":[{"type":"map","map":[{"type":"template","key":"parameter","value":"click_text"},{"type":"template","key":"parameterValue","value":"{{Click Text}}"}]}]}].
variableIdYes
containerIdYes
fingerprintNo
workspaceIdYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed11 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+$"
    • addedInput schema / properties / containerId / pattern
      Added value: +"^\\d+$"
    • 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"
    • addedInput schema / properties / variableId / pattern
      Added value: +"^\\d+$"
    • addedInput schema / properties / workspaceId / pattern
      Added value: +"^\\d+$"
  2. Changed6 schema fields changedv1.35.1
    • addedInput schema / properties / parameter / description
      Added value: +"GTM parameter list — supports NESTED list/map params. Example (a GA4 event parameter table): [{\"type\":\"list\",\"key\":\"eventSettingsTable\",\"list\":[{\"type\":\"map\",\"map\":[{\"type\":\"template\",\"key\":\"parameter\",\"value\":\"click_text\"},{\"type\":\"template\",\"key\":\"parameterValue\",\"value\":\"{{Click Text}}\"}]}]}]."
    • addedInput schema / properties / parameter / items / properties / key / description
      Added value: +"Parameter key/name (omit for entries inside a list)."
    • addedInput schema / properties / parameter / items / properties / list
      Added value: +{
      +  "description": "Child parameters when type=\"list\".",
      +  "items": {
      +    "$ref": "#/properties/parameter/items"
      +  },
      +  "type": "array"
      +}
    • addedInput schema / properties / parameter / items / properties / map
      Added value: +{
      +  "description": "Child parameters when type=\"map\".",
      +  "items": {
      +    "$ref": "#/properties/parameter/items"
      +  },
      +  "type": "array"
      +}
    • addedInput schema / properties / parameter / items / properties / type / description
      Added value: +"template | integer | boolean | list | map | tagReference | triggerReference | template"
    • addedInput schema / properties / parameter / items / properties / value / description
      Added value: +"Scalar value (template/integer/boolean/reference). May be a GTM variable like {{Click Text}}."
  3. First observedv1.0.0

TDQS

A3.7/5.0
Behavior4/5

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

With no annotations supplied, the description carries the full burden and does substantial work: it discloses read-modify-write semantics, that omitted fields are preserved rather than cleared, that `parameter` is merged by key, and that write access requires an environment flag plus explicit confirmation. It does not cover failure behavior or the role of `fingerprint` in concurrent edits, which keeps it short of a 5.

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?

A single tight sentence with the operation and its write gate front-loaded, followed by the subtle merge semantics in a parenthetical. No filler, though the nested parenthetical is dense enough that a second short clause about fingerprint would have been worth the space.

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 mutation tool with no annotations and no output schema, the description covers the critical safety story (write flag, confirm, non-destructive field preservation). It remains incomplete on concurrency control via `fingerprint` and on what a successful update returns, both of which matter for a 10-parameter write operation.

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

Parameters2/5

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

Schema description coverage is only 10% across 10 parameters, so the description should compensate but only clarifies one of them — the merge-by-key behavior of `parameter`. The identifier parameters (accountId/containerId/workspaceId/variableId), `fingerprint` (an optimistic-concurrency token whose omission could silently overwrite another user's edit), and `notes`/`type` get no added meaning.

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 opens with a bracketed [WRITE] marker and a specific verb+resource ('Update a GTM variable'), which cleanly separates it from variables_create, variables_delete, and variables_get in the sibling list. An agent can identify the operation without opening the schema.

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?

It states real prerequisites (GTM_MCP_ENABLE_WRITES=true and confirm=true), which is useful gating context, but it never says when to choose this over variables_create or when a read-modify-write is preferable to a fresh create. Usage is implied rather than contrasted with alternatives.

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