Skip to main content
Glama
rgellis

Google Tag Manager MCP Server

by rgellis

Create Variable

create_variable

Creates a new Google Tag Manager variable in a given workspace. Specify the variable type using Tag Manager codes (v, c, jsm, k, u) and its parameters.

Instructions

Create a variable in a workspace.

Variable types are Tag Manager's internal codes: "v" is a data layer variable, "c" a constant, "jsm" custom JavaScript, "k" a first-party cookie, "u" a URL variable. Copy the shape from an existing variable via get_variable when unsure.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
variableYesVariable resource. Requires name and type, e.g. {"name": "DL - transaction ID", "type": "v", "parameter": [ {"type": "integer", "key": "dataLayerVersion", "value": "2"}, {"type": "template", "key": "name", "value": "ecommerce.transaction_id"}]}.
account_idYesNumeric Tag Manager account ID.
container_idYesNumeric container ID.
workspace_idYesNumeric workspace ID.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.5/5.0
Behavior2/5

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

With no annotations, the description carries the full burden, but it only states that the operation creates and documents variable type codes. It does not disclose side effects, required permissions, idempotency, validation behavior, or any other consequences of the mutation beyond the obvious 'create' semantics.

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 compact: one leading purpose sentence followed by a dense reference for type codes. Every sentence earns its place, and the most important action is front-loaded before the technical detail.

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 the full schema coverage and output schema, the definition covers the required IDs and the nested variable shape, and the description compensates for the one tricky area (type codes and payload shape). It is not exhaustive about when to prefer an existing variable or built-in variable, but an agent has enough to invoke it correctly in common cases.

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?

The schema is fully covered (100%), but the description adds real value by explaining Tag Manager's internal type codes 'v', 'c', 'jsm', 'k', and 'u', which are not semantics in the schema. The advice to copy an existing variable's shape via get_variable also directly helps agents construct the nested 'variable' parameter correctly.

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?

The description opens with a specific verb and resource, 'Create a variable in a workspace', so an agent can tell it is for creating a variable. It does not explicitly differentiate from sibling create tools like create_tag or create_built_in_variable, but the resource name and title make the target clear.

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?

The type-code list and the pointer to 'get_variable ... when unsure' give useful context about how to construct the variable payload. However, the description never directly states when to choose create_variable over update_variable or create_built_in_variable, leaving usage conditions mostly implied.

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