Operates Google Tag Manager via the gtm-cli CLI tool: authentication checks, ID discovery, and CRUD commands for tags, triggers, and variables. Use when a shell is available and no MCP server is present.
Ships in gtm-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
How to drive the commands. For what to do with them, use the matching skill:
| Task | Skill |
|---|---|
| Review or score a container | gtm-container-audit |
| Add, change, delete, publish, roll back | gtm-safe-edit |
| Tracking plan, data layer spec | gtm-tracking-plan |
| GA4 and consent mode | gtm-ga4-consent |
| Server containers | gtm-server-side |
Run gtm-cli version first. If the command is missing, stop and tell the user.
gtm-cli auth status
It prints the identity (email, source, type), scopes and
missingScopes. Tell the user which identity is in use before changing
anything. Exit code 3 means the credentials cannot be used: report the error and
its hint. Logging in needs the user's browser or key file, so never try to work
around it. A missing scope only matters for the operations that need it: reading
and editing use tagmanager.edit.containers, creating versions
tagmanager.edit.containerversions, publishing tagmanager.publish.
Account > Container > Workspace > entities. Never guess an ID. IDs are numeric:
GTM-XXXXXXX is a public ID, not a containerId.
gtm-cli accounts list
gtm-cli containers list --account A
gtm-cli workspaces list --account A --container C
--account, --container and --workspace default to GTM_ACCOUNT_ID,
GTM_CONTAINER_ID and GTM_WORKSPACE_ID, then to the user's config file. Pass
the three flags on every command that changes something, so a default cannot
point the change elsewhere.
The MCP tool verb_noun is the command gtm-cli <nouns> <verb>.
| MCP tool | Command |
|---|---|
list_accounts | gtm-cli accounts list |
list_containers | gtm-cli containers list |
list_workspaces | gtm-cli workspaces list |
get_workspace_status | gtm-cli workspaces status |
list_tags, get_tag | gtm-cli tags list, gtm-cli tags get --tag-id T |
create_tag, update_tag | gtm-cli tags create --file tag.json, gtm-cli tags update --tag-id T --file tag.json |
delete_tag | gtm-cli tags delete --tag-id T --confirm |
list_triggers, get_trigger | gtm-cli triggers list, gtm-cli triggers get --trigger-id R |
create_trigger, update_trigger | gtm-cli triggers create --file trigger.json, gtm-cli triggers update --trigger-id R --file trigger.json |
delete_trigger | gtm-cli triggers delete --trigger-id R --confirm |
list_variables, get_variable | gtm-cli variables list, gtm-cli variables get --variable-id V |
create_variable, update_variable | gtm-cli variables create --file variable.json, gtm-cli variables update --variable-id V --file variable.json |
delete_variable | gtm-cli variables delete --variable-id V --confirm |
get_version, get_live_version | gtm-cli versions get --version-id N, gtm-cli versions get --live |
get_latest_version_header + get_version | gtm-cli versions get --latest |
create_version | gtm-cli versions create --name "..." --notes "..." |
publish_version | gtm-cli versions publish --version-id N --confirm |
Nothing else is available yet: no workspace creation, version list, preview, tag or trigger templates, folders, built-in variables, custom templates, server clients or transformations. Say so and give the steps for the GTM interface.
gtm-cli workspaces status lists each change as type, id, name and
changeStatus (added, updated, deleted), and each merge conflict. Show
this list to the user before gtm-cli versions create.
For an updated entity, show what changed field by field: run
gtm-cli workspaces status --entities and gtm-cli versions get --latest. In
the version, the collection named by type holds the entity before the change;
match it on its ID field (tagId, triggerId, variableId, folderId,
templateId for customTemplate, type for builtInVariable). Ignore path,
fingerprint, tagManagerUrl and workspaceId, which always differ. Compare
with the latest version, not the live one: the workspace is based on the latest.
--file takes one JSON object, from a path or from stdin with -. Parameter,
sequencing and condition shapes are in
tool-input-formats.md. That document
describes MCP tools, which take JSON in strings. In a file, nest the same JSON
under these keys:
| Entity | Keys |
|---|---|
| Tag | name, type, firingTriggerId, blockingTriggerId, parameter, setupTag, teardownTag, consentStatus, consentTypes (array), notes, paused, tagFiringOption |
| Trigger | name, type, filter, autoEventFilter, customEventFilter, eventName, parameter, notes |
| Variable | name, type, parameter, notes |
{
"name": "GA4 - Event - sign_up",
"type": "gaawe",
"firingTriggerId": ["12"],
"parameter": [
{"type": "template", "key": "eventName", "value": "sign_up"},
{"type": "tagReference", "key": "measurementId", "value": ""},
{"type": "template", "key": "measurementIdOverride", "value": "G-XXXXXXX"}
]
}
get is not input: send only the keys
above, with parameters made of type, key, value, list and map.[] or "" clears one.name and type, and keep other omitted
keys.parameter or filter list.get an
existing one and copy its parameter structure.triggerGroup, then set its members with
gtm-cli triggers update and parameter.Output is JSON shaped like the MCP tool's. Errors are JSON on stderr with
error.code and error.message.
| Exit | Meaning | Next step |
|---|---|---|
| 0 | Success | |
| 1 | API or network error | After a write, read the entity before retrying: it may have been applied |
| 2 | Wrong usage or invalid input | Fix the command or file |
| 3 | Authentication | gtm-cli auth status, then ask the user |
| 4 | Permission denied | Ask the user to check GTM access |
| 5 | Not found | Re-discover the IDs |
| 6 | Conflict, or nothing to version | gtm-cli workspaces status |
| 7 | Rate limited | Wait, then retry |
| 8 | Confirmation required | See below |
--dry-run. It prints the request and writes
nothing; for updates it reads the current entity to show the full body.delete and publish need --confirm. The flag is not the user's approval:
show the dry run, say what will happen, and get an explicit yes for that
action first. One approval covers one action.--confirm just because a command exited with code 8.gtm-cli workspaces status, show the changes and get a yes,
gtm-cli versions create, then ask again before gtm-cli versions publish.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
7 skills in this plugin
/gtm-container-auditAudits a Google Tag Manager container and scores it against best practices. Use when asked to review, audit, clean up or health-check a GTM setup or a container export JSON./gtm-ga4-consentSets up and debugs GA4 and consent mode v2 in Google Tag Manager. Use when working on Google tags, GA4 events, cookie banners, consent checks, or duplicate or missing GA4 data./gtm-mcpExplains how to operate the GTM MCP Server, including ID discovery, tool input formats and safety guards. Use when its GTM tools are available or a tool rejects JSON input./gtm-safe-editPlans and applies Google Tag Manager changes without breaking production. Use when adding, editing, deleting, publishing or rolling back GTM tags, triggers, variables or templates./gtm-server-sideReviews and configures server-side Google Tag Manager containers. Use when working on sGTM clients, server tags, transformations, PII redaction or first-party tagging domains./gtm-tracking-planWrites tracking plans and dataLayer specs for Google Tag Manager. Use when asked to document what a container tracks, plan events for measurement goals, or brief developers./gtm-skills:gtm-clifrom gtm-skills
npx claudepluginhub paolobietolini/gtm-mcp-server --plugin gtm-skillsOther plugins' skills for the same job