Google Tag Manager MCP Server
Provides tools for managing Google Tag Manager accounts, containers, workspaces, tags, triggers, variables, versions, folders, and permissions through the Tag Manager API v2.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Google Tag Manager MCP Server Show me all tags in workspace 42 of container GTM-ABC123."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Google Tag Manager MCP Server
An MCP server covering the entire Google Tag Manager API v2 — all 106 published methods, plus task-shaped tools on top for the workflows people actually run against a container.
Overview
This project provides a Model Context Protocol server that wraps the Google Tag Manager API v2, letting LLMs read and write accounts, containers, workspaces, tags, triggers, variables, versions and permissions through a standardised interface.
Tag Manager ships no official SDK in any language, so this is built on the
generic google-api-python-client with complete static types supplied by
google-api-python-client-stubs. See
Why there is no Tag Manager SDK.
Related MCP server: Google Tag Manager MCP Server
Features
Complete API Coverage: all 106 published API methods, enforced by a test rather than claimed
Full Type Safety: strict
pyrightwith 0 errors100% Test Coverage: 383 tests, 100% statement and branch coverage, floor enforced in config
Task-Shaped Tools: 6 convenience tools on top of the raw API
ID-Based Addressing: tools take account/container/workspace IDs; relative paths are assembled and validated for you
MCP Compliant: FastMCP 4, stdio transport
Async Throughout: the synchronous Google client is dispatched off the event loop
Read-Only Mode: an opt-in switch that refuses every mutating call
Installation
git clone https://github.com/rgellis/google-tag-manager-mcp.git
cd google-tag-manager-mcp
# Install dependencies using uv
uv syncRequires Python 3.12+.
1. Enable the API
The Tag Manager API must be enabled on the Google Cloud project that owns your OAuth client:
gcloud services enable tagmanager.googleapis.com --project=<project>2. Create an OAuth client
In the Google Cloud console, create an OAuth 2.0 client of type Desktop app
(or Web application with http://localhost as an authorised redirect URI).
Note the client ID and secret.
3. Mint a refresh token
GOOGLE_CLIENT_ID="..." GOOGLE_CLIENT_SECRET="..." \
uv run scripts/get_refresh_token.py
# or, if this server will only ever read:
GOOGLE_CLIENT_ID="..." GOOGLE_CLIENT_SECRET="..." \
uv run scripts/get_refresh_token.py --read-onlySign in as an account with access to the Tag Manager containers you need. The script prints the refresh token.
Scope the token to this server alone rather than reusing one minted for other Google APIs — re-consenting a shared token to add the Tag Manager scopes rotates a secret everything else using it depends on.
4. Set credentials
export GOOGLE_CLIENT_ID="your_client_id"
export GOOGLE_CLIENT_SECRET="your_client_secret"
export GOOGLE_TAG_MANAGER_REFRESH_TOKEN="token_from_step_3"
# optional: request only the readonly scope and refuse all mutations
export TAG_MANAGER_READ_ONLY=falseIf those three are not all set, the client falls back to Application Default
Credentials, which covers a service account via GOOGLE_APPLICATION_CREDENTIALS
as well as local gcloud auth.
5. Verify
uv run main.py --groups accountsThen call check_client_status, which reports whether credentials resolve, the
scopes in use, and whether read-only mode is active — without spending API quota.
Usage
uv run main.py # all 112 tools, over stdio
uv run main.py --groups web # the web-container subset
uv run main.py --groups tags,triggers # a specific subsetGroups: accounts, user-permissions, containers, destinations,
environments, versions, workspaces, tags, triggers, variables,
built-in-variables, folders, templates, clients, transformations,
zones, gtag-config, insights.
--groups matters more here than on a small API. An MCP client pays for every
tool description in its context on every request, and 112 of them is a lot to
carry when the task is "read the tags in this container". web is a useful
default for web containers: accounts, containers, workspaces, versions, tags,
triggers, variables, built-in variables, folders and the task-shaped tools,
leaving out the server-side (clients, transformations) and 360-only
(zones) resources.
With an MCP client
{
"mcpServers": {
"tag-manager": {
"command": "uv",
"args": ["run", "--directory", "/path/to/google-tag-manager-mcp", "main.py", "--groups", "web"],
"env": {
"GOOGLE_CLIENT_ID": "...",
"GOOGLE_CLIENT_SECRET": "...",
"GOOGLE_TAG_MANAGER_REFRESH_TOKEN": "..."
}
}
}
}Identifiers
Every Tag Manager resource is addressed by a relative path such as
accounts/6000000000/containers/7000000/workspaces/3/tags/42, and the API
validates each one against a regex — a path of the wrong shape is rejected
before any permission check, so a malformed ID surfaces as a confusing 400 or
404 rather than "you got the shape wrong".
Tools therefore take the individual IDs and assemble the path for you:
get_tag(account_id="6000000000", container_id="7000000",
workspace_id="3", tag_id="42")The API's own collection/id spelling is accepted too (account_id="accounts/6000000000"),
since that is what you have to hand when copying an ID out of a previous
response. A longer path is rejected rather than silently truncated — guessing
which segment was meant is how you end up writing to the wrong container.
Starting from a GTM-XXXXXXX off a website with no account ID? Call
lookup_container, the one read that needs no account.
The Tag Manager model, in four sentences
An account holds containers; a container is what a site loads. Edits happen in a workspace, which is a draft branch — nothing in one affects the live site. Turning a workspace into a version freezes its entities and consumes the workspace. Publishing a version is what reaches production, and it does so immediately, for every visitor.
publish_workspace performs the last two steps and defaults publish to
false, so creating a version is never silently a release.
Feature Parity Table
Implementation status of Google Tag Manager API v2 methods (discovery revision 20260916). All 106 methods are implemented; the table groups them by resource.
Tools | Category | API Methods | Implemented | Test Coverage | Notes |
| Accounts |
| ✅ Yes | ✅ Yes | Start here for account IDs |
| User Permissions |
| ✅ Yes | ✅ Yes | Update takes no fingerprint |
| Containers |
| ✅ Yes | ✅ Yes |
|
| Destinations |
| ✅ Yes | ✅ Yes | Linking moves, it does not copy |
| Environments |
| ✅ Yes | ✅ Yes | Reauthorize rotates the preview code |
| Version Headers |
| ✅ Yes | ✅ Yes | Cheap history, no entity payload |
| Versions |
| ✅ Yes | ✅ Yes | ⚠️ |
| Workspaces |
| ✅ Yes | ✅ Yes |
|
| Tags |
| ✅ Yes | ✅ Yes | Update replaces, it does not merge |
| Triggers |
| ✅ Yes | ✅ Yes | Referenced by tag |
| Variables |
| ✅ Yes | ✅ Yes | User-defined variables only |
| Built-In Variables |
| ✅ Yes | ✅ Yes | Addressed by type, not ID; three distinct paths |
| Folders |
| ✅ Yes | ✅ Yes |
|
| Templates |
| ✅ Yes | ✅ Yes | Gallery import needs explicit permission ack |
| Clients |
| ✅ Yes | ✅ Yes | Server containers only |
| Transformations |
| ✅ Yes | ✅ Yes | Server containers only |
| Zones |
| ✅ Yes | ✅ Yes | Tag Manager 360 only |
| Google Tag Config |
| ✅ Yes | ✅ Yes | The only entity with no revert method |
| Task-Shaped | (compose several methods) | ✅ Yes | ✅ Yes | See below |
| Diagnostics | (no API call) | ✅ Yes | ✅ Yes | Credential state; spends no quota |
Task-shaped tools
Nothing here maps one-to-one onto an API method. Each exists because the raw API makes a common task take several round trips that have to be sequenced correctly.
Tool | Composes | Why |
|
| Reading a container's setup is four paginated calls |
| the same four, filtered by name | The API has no search; turns "the purchase tag" into an ID |
|
| "What is this container and what is it running" |
|
| "What do I have access to", in one call |
|
| The release flow, with |
Summary Statistics
API Methods Implemented: 106 out of 106 Tag Manager API v2 methods (100%)
Total Tools: 112 (106 API methods + 6 convenience tools)
Tools with Tests: 112 (100% tool coverage, enforced end to end)
Line & Branch Coverage: 100% across
src(1,471 statements, 94 branches), enforced byfail_under = 100Test Count: 383
Type Safety:
pyrightstrict, 0 errors
Implementation Highlights
✅ Complete API Surface: every published method across all 18 resources
✅ Coverage Enforced, Not Claimed:
tests/test_api_coverage.pydiffs the implementation against the vendored discovery document in both directions✅ End-to-End Tool Tests: every one of the 112 tools is invoked through a real MCP client, and
test_every_registered_tool_is_exercisedfails if a tool is added without one✅ Paths Built, Not Pasted: relative paths are assembled from IDs in one place and validated, so a malformed identifier fails with a clear message instead of a 404
✅ Publishing Is Explicit:
publish_workspacewill not release unless asked, and never publishes a version that failed to compile
Key Features
Typed Discovery Client: complete static types from
google-api-python-client-stubsOff-Loop Execution: the synchronous Google client is dispatched via
asyncio.to_thread, so it never blocks the MCP event loopUniform Error Translation: one
execute()helper turnsHttpErrorinto a readable message, with per-status hints — a 400 usually means a stale fingerprint, a 404 usually means the wrong IDLazy Client Initialisation: credentials resolve on first use, so the server starts even when misconfigured and
check_client_statuscan say whyRead-Only Mode:
TAG_MANAGER_READ_ONLY=truerequests the readonly scope and refuses every mutation
Scopes
Tag Manager splits write access six ways, so a token covering the whole API has
to carry all of them. TAG_MANAGER_READ_ONLY=true requests only the first.
Scope | Needed for |
| Every read |
| Editing containers and workspace entities |
| Creating, editing and deleting versions |
| Deleting containers and workspaces |
| Updating account settings |
| User permissions |
| Publishing versions, reauthorizing environments |
A 403 from a call whose read equivalent works usually means the token is missing one of these, not that the user lacks permission.
API quirks worth knowing
These are published behaviours, implemented as published and documented in
src/coverage.py under QUIRKS rather than worked around:
built_in_variablesis addressed by type rather than ID, takes a list of types on create and delete but a single type on revert, and uses three different paths across its four methods.folders.entitiesis a POST that reads. It is not gated by read-only mode.environments.reauthorizeandfolders.move_entities_to_folderrequire a request body they make no use of; an empty object is sent when you supply none.gtag_configis the only workspace entity with no revert method.Fingerprints are Tag Manager's optimistic concurrency control. Every entity carries one, and passing it to an update rejects the write if the entity changed since you read it. A 400 mentioning a fingerprint means re-read and retry, not malformed input.
Why there is no Tag Manager SDK
Tag Manager is a discovery-document API. Google ships no dedicated client
library for it in any language — no equivalent of google-ads or
google-analytics-data. It is one of ~300 APIs served by the generic
google-api-python-client, whose resources are built dynamically at runtime and
are entirely untyped.
Other languages fare better, because their generic clients generate code at build
time into per-API packages: Go has google.golang.org/api/tagmanager/v2, Java
has google-api-services-tagmanager, .NET has Google.Apis.TagManager.v2, and
Node's googleapis ships Schema$* TypeScript interfaces. Python is the
outlier — its client parses the discovery document at runtime, so there is
nothing to type-check.
That would normally rule out strict type checking. The way out is
google-api-python-client-stubs, which covers tagmanager/v2 completely, with a
build() overload keyed on the literal service name. It is a dev-only
dependency — stubs never ship at runtime, so if it goes stale the cost is
type-checking, not functionality.
Three consequences to know before editing:
src/client.pyimportsTagManagerResourceunderif TYPE_CHECKING:. Thegoogleapiclient._apispackage does not exist at runtime; that guard must stay.FastMCP resolves tool annotations at runtime, so tool signatures use
Dict[str, Any]while the service layer beneath stays precisely typed. Annotating a tool with a stub type raisesNameErrorat registration.The stubs are not always right. They type
built_in_variables'typeparameter as a singleLiteralwhere the discovery document marks it repeated. The discovery document is authoritative at runtime, so lists are sent.
Testing
# Run tests
uv run pytest
# Run tests with coverage (must stay at 100%)
.venv/bin/python -m pytest --cov --cov-report=term-missing
# Run type checking
uv run pyright
# Run code formatting
uv run ruff format .
# Everything at once
./scripts/typecheck.shCoverage is invoked as .venv/bin/python -m pytest rather than uv run pytest
for one reason, documented in pyproject.toml: constructing a FastMCP instance
inside a coverage-instrumented module trips a type check in cryptography's Rust
bindings, so main.py is excluded from the measured source set and covered
end-to-end by tests/test_api_coverage.py and tests/test_tools.py instead.
Development without a local toolchain
uv and Python 3.12 are not required on the workstation. The whole toolchain
runs in Docker:
docker run --rm -v "$PWD":/app -w /app python:3.12-slim \
bash -c 'apt-get update -qq && apt-get install -y -qq libatomic1 \
&& pip install -q uv && uv sync --extra dev && ./scripts/typecheck.sh'libatomic1 is needed by the Node binary pyright downloads; without it
pyright fails with a shared-library error rather than a type error.
Test layout
File | Covers |
| Every one of the 112 tools invoked through a real MCP client, end to end |
| The API coverage contract, both directions, plus group selection |
| The six resources sharing the CRUD+revert shape, parametrised |
| Templates, folders, gtag config and built-in variables |
| Accounts and user permissions |
| Containers and destinations |
| Environments |
| Versions and version headers |
| Workspaces, sync, conflicts, version creation |
| Pagination, name search, container summary, the release flow |
| Credential resolution, scopes, read-only gate, lifecycle |
| Error translation, status hints, off-loop dispatch |
| Relative path construction and identifier validation |
| Logging, dotenv, env flags, optional-parameter handling |
When Google revises the API
uv run scripts/refresh_discovery.py
uv run pytest tests/test_api_coverage.pyrefresh_discovery.py prints exactly which methods were added or removed. A new
method fails test_every_api_method_is_declared until it is implemented and
mapped in src/coverage.py. A removed one fails
test_no_declared_method_has_been_removed. That failure is the intended alarm —
do not weaken the test.
Repository layout
src/client.py credentials, typed discovery client, read-only gate
src/coverage.py API method -> tool mapping; the coverage contract
src/paths.py relative path construction and identifier validation
src/services/ one module per API resource
src/services/base.py off-loop dispatch and error translation
src/services/insights_service.py the task-shaped tools
refs/ vendored discovery document
scripts/ token minting, discovery refresh, checks
tests/ 383 tests, 100% coverage
main.py stdio MCP serverContributing
Contributions are welcome. Please ensure:
All code has proper type annotations
Tests are added for new functionality — coverage must stay at 100%
Code passes
uv run pyrightwith no errorsCode is formatted with
uv run ruff formatAny new API method is mapped in
src/coverage.py
License
MIT — see LICENSE.
Disclaimer
This is an unofficial integration and is not affiliated with or endorsed by
Google. Tag Manager API quotas apply. Publishing a container version takes effect
on the live site immediately — TAG_MANAGER_READ_ONLY=true exists for a reason.
Available Tools
112 toolsbulk_update_workspaceBulk Update WorkspaceA
Apply many entity changes to a workspace in a single call.
Use this when creating entities that reference each other -- a tag and the trigger that fires it, say -- since one call keeps them consistent.
Inputs: account_id (required), container_id (required), workspace_id (required), proposed_change (required). Returns: object
check_client_statusCheck Client StatusA
Check that the Tag Manager client is configured and can authenticate.
Returns: Whether credentials resolve, whether the server is in read-only mode, and the OAuth scopes in use.
Inputs: no named parameters. Returns: object
combine_containersCombine ContainersC
Merge one container into another.
Inputs: account_id (required), container_id (required), other_container_id (required), setting_source, +1 more. Returns: object
create_built_in_variableCreate Built In VariableB
Enable built-in variables in a workspace.
Inputs: types (required), account_id (required), container_id (required), workspace_id (required). Returns: object
create_clientCreate ClientA
Create a client in a workspace.
Only server containers accept clients. Creating one in a web container fails.
Inputs: client (required), account_id (required), container_id (required), workspace_id (required). Returns: object
create_containerCreate ContainerC
Create a container in a Tag Manager account.
Inputs: container (required), account_id (required). Returns: object
create_environmentCreate EnvironmentC
Create an environment in a container.
Inputs: account_id (required), environment (required), container_id (required). Returns: object
create_folderCreate FolderC
Create a folder in a workspace.
Inputs: folder (required), account_id (required), container_id (required), workspace_id (required). Returns: object
create_gtag_configCreate Gtag ConfigB
Create a Google tag configuration in a workspace.
Inputs: account_id (required), gtag_config (required), container_id (required), workspace_id (required). Returns: object
create_tagCreate TagC
Create a tag in a workspace.
Inputs: tag (required), account_id (required), container_id (required), workspace_id (required). Returns: object
create_templateCreate TemplateC
Create a custom template in a workspace.
Inputs: template (required), account_id (required), container_id (required), workspace_id (required). Returns: object
create_transformationCreate TransformationA
Create a transformation in a workspace.
Only server containers accept transformations. Creating one in a web container fails.
Inputs: account_id (required), container_id (required), workspace_id (required), transformation (required). Returns: object
create_triggerCreate TriggerA
Create a trigger in a workspace.
Trigger types are Tag Manager's internal codes: "pageview", "domReady", "windowLoaded", "click", "linkClick", "formSubmission", "customEvent", "timer" and so on. Copy the shape from an existing trigger via get_trigger when unsure.
Inputs: trigger (required), account_id (required), container_id (required), workspace_id (required). Returns: object
create_user_permissionCreate User PermissionB
Grant a user access to a Tag Manager account.
Inputs: account_id (required), user_permission (required). Returns: object
create_variableCreate VariableA
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.
Inputs: variable (required), account_id (required), container_id (required), workspace_id (required). Returns: object
create_versionCreate VersionA
Turn a workspace into a container version.
The workspace is consumed by this call -- the API deletes it and makes the new version the container's latest. Creating a version does not publish it; use publish_version for that.
Inputs: account_id (required), container_id (required), workspace_id (required), version_options. Returns: object
create_workspaceCreate WorkspaceC
Create a workspace in a container.
Inputs: workspace (required), account_id (required), container_id (required). Returns: object
create_zoneCreate ZoneA
Create a zone in a workspace.
Zones require Tag Manager 360. Creating one in a standard container fails.
Inputs: zone (required), account_id (required), container_id (required), workspace_id (required). Returns: object
delete_built_in_variableDelete Built In VariableB
Disable built-in variables in a workspace.
Anything referencing a disabled variable stops resolving, so check for uses first.
Inputs: types (required), account_id (required), container_id (required), workspace_id (required). Returns: object
delete_clientDelete ClientA
Delete a client from a workspace.
This affects the workspace only. The client stays in production until a version without it is published.
Inputs: client_id (required), account_id (required), container_id (required), workspace_id (required). Returns: object
delete_containerDelete ContainerA
Delete a container, and with it every workspace, tag and version.
This cannot be undone through the API, and any site still loading the container's snippet stops receiving tags.
Inputs: account_id (required), container_id (required). Returns: object
delete_environmentDelete EnvironmentA
Delete a container environment.
The built-in Live and Latest environments cannot be deleted.
Inputs: account_id (required), container_id (required), environment_id (required). Returns: object
delete_folderDelete FolderA
Delete a folder from a workspace.
The entities inside it are not deleted; they are left unfiled.
Inputs: folder_id (required), account_id (required), container_id (required), workspace_id (required). Returns: object
delete_gtag_configDelete Gtag ConfigA
Delete a Google tag configuration from a workspace.
Unlike every other workspace entity, Google tag configs have no revert method, so this cannot be undone short of discarding the workspace.
Inputs: account_id (required), container_id (required), workspace_id (required), gtag_config_id (required). Returns: object
delete_tagDelete TagA
Delete a tag from a workspace.
This affects the workspace only. The tag keeps running in production until a version without it is published.
Inputs: tag_id (required), account_id (required), container_id (required), workspace_id (required). Returns: object
delete_templateDelete TemplateA
Delete a custom template from a workspace.
Tags and variables using the template stop working, so check for uses before deleting.
Inputs: account_id (required), template_id (required), container_id (required), workspace_id (required). Returns: object
delete_transformationDelete TransformationA
Delete a transformation from a workspace.
This affects the workspace only. The transformation stays in production until a version without it is published.
Inputs: account_id (required), container_id (required), workspace_id (required), transformation_id (required). Returns: object
delete_triggerDelete TriggerA
Delete a trigger from a workspace.
This affects the workspace only. The trigger stays in production until a version without it is published.
Inputs: account_id (required), trigger_id (required), container_id (required), workspace_id (required). Returns: object
delete_user_permissionDelete User PermissionA
Revoke a user's access to a Tag Manager account.
Inputs: account_id (required), permission_id (required). Returns: object
delete_variableDelete VariableA
Delete a variable from a workspace.
This affects the workspace only. The variable stays in production until a version without it is published.
Inputs: account_id (required), variable_id (required), container_id (required), workspace_id (required). Returns: object
delete_versionDelete VersionA
Delete a container version.
Deletion is reversible with undelete_version. The live version cannot be deleted.
Inputs: account_id (required), version_id (required), container_id (required). Returns: object
delete_workspaceDelete WorkspaceA
Delete a workspace, discarding every change in it.
Changes that were never turned into a version are lost. Check get_workspace_status first.
Inputs: account_id (required), container_id (required), workspace_id (required). Returns: object
delete_zoneDelete ZoneA
Delete a zone from a workspace.
This affects the workspace only. The zone stays in production until a version without it is published.
Inputs: zone_id (required), account_id (required), container_id (required), workspace_id (required). Returns: object
find_entities_by_nameFind Entities By NameA
Find tags, triggers and variables by name.
The API has no search, so this reads each collection and filters. Use it to turn a name a human used ("the purchase tag") into the ID the other tools need.
Inputs: query (required), account_id (required), container_id (required), workspace_id (required). Returns: object
get_accountGet AccountB
Get one Tag Manager account.
Inputs: account_id (required). Returns: object
get_clientGet ClientC
Get one client from a workspace.
Inputs: client_id (required), account_id (required), container_id (required), workspace_id (required). Returns: object
get_containerGet ContainerB
Get one Tag Manager container.
Inputs: account_id (required), container_id (required). Returns: object
get_container_snippetGet Container SnippetA
Get the HTML install snippet for a container.
Inputs: account_id (required), container_id (required). Returns: object
get_destinationGet DestinationA
Get one destination linked to a container.
Inputs: account_id (required), container_id (required), destination_id (required). Returns: object
get_environmentGet EnvironmentA
Get one container environment.
Inputs: account_id (required), container_id (required), environment_id (required). Returns: object
get_folderGet FolderB
Get one folder from a workspace.
Inputs: folder_id (required), account_id (required), container_id (required), workspace_id (required). Returns: object
get_folder_entitiesGet Folder EntitiesA
List the tags, triggers and variables inside a folder.
Inputs: folder_id (required), account_id (required), container_id (required), workspace_id (required), +1 more. Returns: object
get_gtag_configGet Gtag ConfigA
Get one Google tag configuration from a workspace.
Inputs: account_id (required), container_id (required), workspace_id (required), gtag_config_id (required). Returns: object
get_latest_version_headerGet Latest Version HeaderA
Get the header of a container's most recently created version.
This is the newest version, which is not necessarily the published one -- use get_live_version for what production is serving.
Inputs: account_id (required), container_id (required). Returns: object
get_live_versionGet Live VersionA
Get the container version currently published to production.
This is what visitors to the site are actually running, which is the right starting point for "what is live right now".
Inputs: account_id (required), container_id (required). Returns: object
get_tagGet TagC
Get one tag from a workspace.
Inputs: tag_id (required), account_id (required), container_id (required), workspace_id (required). Returns: object
get_templateGet TemplateA
Get one custom template, including its sandboxed JavaScript source.
Inputs: account_id (required), template_id (required), container_id (required), workspace_id (required). Returns: object
get_transformationGet TransformationB
Get one transformation from a workspace.
Inputs: account_id (required), container_id (required), workspace_id (required), transformation_id (required). Returns: object
get_triggerGet TriggerA
Get one trigger from a workspace.
Inputs: account_id (required), trigger_id (required), container_id (required), workspace_id (required). Returns: object
get_user_permissionGet User PermissionA
Get one user's access to a Tag Manager account.
Inputs: account_id (required), permission_id (required). Returns: object
get_variableGet VariableA
Get one variable from a workspace.
Inputs: account_id (required), variable_id (required), container_id (required), workspace_id (required). Returns: object
get_versionGet VersionB
Get one container version, including every entity it contains.
Inputs: account_id (required), version_id (required), container_id (required), container_version_id. Returns: object
get_workspaceGet WorkspaceC
Get one workspace.
Inputs: account_id (required), container_id (required), workspace_id (required). Returns: object
get_workspace_statusGet Workspace StatusA
List what a workspace has changed, and what conflicts with the base.
Run this before creating a version: it is the diff between the workspace and the container version it was branched from.
Inputs: account_id (required), container_id (required), workspace_id (required). Returns: object
get_zoneGet ZoneB
Get one zone from a workspace.
Inputs: zone_id (required), account_id (required), container_id (required), workspace_id (required). Returns: object
import_template_from_galleryImport Template From GalleryA
Import a template from the Community Template Gallery.
Gallery templates are third-party code that runs on the site, and the import declares the permissions the template asks for -- acknowledge_permissions must be true or the call fails. Review what it requests before importing.
Inputs: account_id (required), container_id (required), workspace_id (required), gallery_sha, +3 more. Returns: object
link_destinationLink DestinationA
Link a Google tag destination to a container.
The destination is taken from whichever container currently holds it, so this moves rather than copies.
Inputs: account_id (required), container_id (required), destination_id (required), allow_user_permission_feature_update. Returns: object
list_accountsList AccountsA
List the Google Tag Manager accounts this user can access.
Start here: every other tool needs an account ID, and the numbers shown in the Tag Manager web UI's URL are not always the API's account IDs.
Inputs: page_token, include_google_tags. Returns: object
list_all_containersList All ContainersA
List every container this user can reach, across every account.
Answers "what do I have access to" in one call instead of one list_containers per account. An account that cannot be read is reported with its error rather than failing the whole call.
Inputs: include_google_tags. Returns: object
list_built_in_variablesList Built In VariablesA
List the built-in variables enabled in a workspace.
Built-in variables (Page URL, Click Text, and so on) are supplied by Tag Manager and only need enabling. They are separate from the user-defined variables in list_variables.
Inputs: account_id (required), container_id (required), workspace_id (required), page_token. Returns: object
list_clientsList ClientsA
List the clients in a workspace.
A web container returns an empty list; clients exist only in server containers.
Inputs: account_id (required), container_id (required), workspace_id (required), page_token. Returns: object
list_containersList ContainersB
List the containers in a Tag Manager account.
Inputs: account_id (required), page_token. Returns: object
list_destinationsList DestinationsB
List the Google tag destinations linked to a container.
Inputs: account_id (required), container_id (required). Returns: object
list_environmentsList EnvironmentsA
List a container's environments.
Every container has a Live and a Latest environment; the rest are user-created preview targets.
Inputs: account_id (required), container_id (required), page_token. Returns: object
list_foldersList FoldersB
List the folders in a workspace.
Inputs: account_id (required), container_id (required), workspace_id (required), page_token. Returns: object
list_gtag_configsList Gtag ConfigsA
List the Google tag configurations in a workspace.
These are the gtag.js settings a Google tag applies to its destinations -- the API equivalent of the "Configuration settings" panel on a Google tag.
Inputs: account_id (required), container_id (required), workspace_id (required), page_token. Returns: object
list_tagsList TagsA
List the tags in a workspace.
Inputs: account_id (required), container_id (required), workspace_id (required), page_token. Returns: object
list_templatesList TemplatesB
List the custom templates in a workspace.
Inputs: account_id (required), container_id (required), workspace_id (required), page_token. Returns: object
list_transformationsList TransformationsA
List the transformations in a workspace.
A web container returns an empty list; transformations exist only in server containers.
Inputs: account_id (required), container_id (required), workspace_id (required), page_token. Returns: object
list_triggersList TriggersA
List the triggers in a workspace.
Triggers are referenced by tags through firingTriggerId and blockingTriggerId, so list these before creating a tag.
Inputs: account_id (required), container_id (required), workspace_id (required), page_token. Returns: object
list_user_permissionsList User PermissionsB
List who has access to a Tag Manager account, and at what level.
Inputs: account_id (required), page_token. Returns: object
list_variablesList VariablesB
List the variables in a workspace.
Other entities reference these by name in {{double braces}}, so the names here are what tag and trigger parameters point at.
Inputs: account_id (required), container_id (required), workspace_id (required), page_token. Returns: object
list_version_headersList Version HeadersA
List a container's version history as lightweight headers.
Prefer this over fetching versions when you want the history: a header carries the ID, name and entity counts without the full snapshot of every tag in the version.
Inputs: account_id (required), container_id (required), page_token, include_deleted. Returns: object
list_workspace_entitiesList Workspace EntitiesA
Read everything configured in a workspace in one call.
Fetches tags, triggers, variables and folders, following pagination on each. Prefer this over four separate list calls when you want to understand or audit a container's setup.
Inputs: account_id (required), container_id (required), workspace_id (required). Returns: object
list_workspacesList WorkspacesB
List a container's workspaces.
A workspace is the draft layer: tags, triggers and variables are edited in one, and nothing reaches production until it becomes a version and that version is published. Every container has a "Default Workspace".
Inputs: account_id (required), container_id (required), page_token. Returns: object
list_zonesList ZonesA
List the zones in a workspace.
A standard (non-360) container returns an empty list.
Inputs: account_id (required), container_id (required), workspace_id (required), page_token. Returns: object
lookup_containerLookup ContainerA
Find a container from its public GTM-XXXXXXX tag ID.
Use this when you have a tag ID from a website's source but no account ID. Pass exactly one of the two arguments.
Inputs: tag_id, destination_id. Returns: object
move_entities_to_folderMove Entities To FolderA
Move tags, triggers and variables into a folder.
Pass folder_id "0" to take the entities out of their current folder instead of putting them into one.
Inputs: folder_id (required), account_id (required), container_id (required), workspace_id (required), +4 more. Returns: object
move_tag_idMove Tag IdA
Move a tag ID out of a container into a newly created one.
The inverse of combine_containers: it splits a tag ID off a container that holds several.
Inputs: account_id (required), container_id (required), tag_id, tag_name, +4 more. Returns: object
publish_versionPublish VersionA
Publish a container version to production.
This takes effect on the live site immediately, for every visitor, with no staged rollout. The only way back is to publish an earlier version over the top. Confirm the version is the intended one before calling.
Inputs: account_id (required), version_id (required), container_id (required), fingerprint. Returns: object
publish_workspacePublish WorkspaceA
Create a container version from a workspace, optionally publishing it.
This is the Tag Manager release flow: a workspace becomes a version, and a version is published. Creating the version consumes the workspace either way.
publish defaults to false. Passing true releases to the live site immediately, for every visitor -- confirm that is intended before setting it. A version that fails to compile is never published.
Inputs: account_id (required), container_id (required), workspace_id (required), name, +2 more. Returns: object
quick_preview_workspaceQuick Preview WorkspaceA
Compile a workspace into a throwaway version to check it is valid.
Nothing is saved and nothing is published; this is the cheap way to find compiler errors before create_version.
Inputs: account_id (required), container_id (required), workspace_id (required). Returns: object
reauthorize_environmentReauthorize EnvironmentA
Regenerate an environment's authorization code.
Use this when a preview link has leaked: the old code stops working immediately, so anything embedding it must be updated.
Inputs: account_id (required), container_id (required), environment_id (required), environment. Returns: object
resolve_workspace_conflictResolve Workspace ConflictB
Resolve one merge conflict raised by sync_workspace.
Inputs: entity (required), account_id (required), container_id (required), workspace_id (required), +1 more. Returns: object
revert_built_in_variableRevert Built In VariableB
Undo a workspace's change to one built-in variable.
Inputs: account_id (required), container_id (required), workspace_id (required), variable_type. Returns: object
revert_clientRevert ClientA
Undo a workspace's changes to one client.
Restores the client to the state of the container version the workspace was branched from, leaving the workspace's other changes alone.
Inputs: client_id (required), account_id (required), container_id (required), workspace_id (required), +1 more. Returns: object
revert_folderRevert FolderC
Undo a workspace's changes to one folder.
Inputs: folder_id (required), account_id (required), container_id (required), workspace_id (required), +1 more. Returns: object
revert_tagRevert TagA
Undo a workspace's changes to one tag.
Restores the tag to the state of the container version the workspace was branched from, leaving the workspace's other changes alone.
Inputs: tag_id (required), account_id (required), container_id (required), workspace_id (required), +1 more. Returns: object
revert_templateRevert TemplateC
Undo a workspace's changes to one custom template.
Inputs: account_id (required), template_id (required), container_id (required), workspace_id (required), +1 more. Returns: object
revert_transformationRevert TransformationA
Undo a workspace's changes to one transformation.
Restores the transformation to the state of the container version the workspace was branched from, leaving the workspace's other changes alone.
Inputs: account_id (required), container_id (required), workspace_id (required), transformation_id (required), +1 more. Returns: object
revert_triggerRevert TriggerA
Undo a workspace's changes to one trigger.
Restores the trigger to the state of the container version the workspace was branched from, leaving the workspace's other changes alone.
Inputs: account_id (required), trigger_id (required), container_id (required), workspace_id (required), +1 more. Returns: object
revert_variableRevert VariableA
Undo a workspace's changes to one variable.
Restores the variable to the state of the container version the workspace was branched from, leaving the workspace's other changes alone.
Inputs: account_id (required), variable_id (required), container_id (required), workspace_id (required), +1 more. Returns: object
revert_zoneRevert ZoneA
Undo a workspace's changes to one zone.
Restores the zone to the state of the container version the workspace was branched from, leaving the workspace's other changes alone.
Inputs: zone_id (required), account_id (required), container_id (required), workspace_id (required), +1 more. Returns: object
set_latest_versionSet Latest VersionA
Set the version that workspaces sync against.
This is the baseline used to detect conflicts when a workspace syncs. It does not change what is published.
Inputs: account_id (required), version_id (required), container_id (required). Returns: object
summarize_containerSummarize ContainerA
Summarise a container: settings, workspaces and what is live.
The quickest answer to "what is this container and what is it running".
Inputs: account_id (required), container_id (required). Returns: object
sync_workspaceSync WorkspaceA
Bring a workspace up to date with the latest container version.
Unmodified entities are updated in place; anything the workspace also changed comes back as a merge conflict to resolve with resolve_workspace_conflict.
Inputs: account_id (required), container_id (required), workspace_id (required). Returns: object
undelete_versionUndelete VersionC
Restore a deleted container version.
Inputs: account_id (required), version_id (required), container_id (required). Returns: object
update_accountUpdate AccountB
Update a Tag Manager account's settings.
Inputs: account (required), account_id (required), fingerprint. Returns: object
update_clientUpdate ClientA
Update a client in a workspace.
The client you send replaces the stored one, so read it with get_client first and send the whole thing back with your edits applied. Omitted fields are cleared, not preserved.
Inputs: client (required), client_id (required), account_id (required), container_id (required), +2 more. Returns: object
update_containerUpdate ContainerC
Update a container's settings.
Inputs: container (required), account_id (required), container_id (required), fingerprint. Returns: object
update_environmentUpdate EnvironmentB
Update a container environment.
Inputs: account_id (required), environment (required), container_id (required), environment_id (required), +1 more. Returns: object
update_folderUpdate FolderB
Update a folder's name or notes.
Inputs: folder (required), folder_id (required), account_id (required), container_id (required), +2 more. Returns: object
update_gtag_configUpdate Gtag ConfigA
Update a Google tag configuration.
The config you send replaces the stored one, so read it with get_gtag_config first and send the whole thing back with your edits applied.
Inputs: account_id (required), gtag_config (required), container_id (required), workspace_id (required), +2 more. Returns: object
update_tagUpdate TagA
Update a tag in a workspace.
The tag you send replaces the stored one, so read it with get_tag first and send the whole thing back with your edits applied. Omitted fields are cleared, not preserved.
Inputs: tag (required), tag_id (required), account_id (required), container_id (required), +2 more. Returns: object
update_templateUpdate TemplateA
Update a custom template in a workspace.
The template you send replaces the stored one, so read it with get_template first and send the whole thing back with your edits applied.
Inputs: template (required), account_id (required), template_id (required), container_id (required), +2 more. Returns: object
update_transformationUpdate TransformationA
Update a transformation in a workspace.
The transformation you send replaces the stored one, so read it with get_transformation first and send the whole thing back with your edits applied. Omitted fields are cleared, not preserved.
Inputs: account_id (required), container_id (required), workspace_id (required), transformation (required), +2 more. Returns: object
update_triggerUpdate TriggerA
Update a trigger in a workspace.
The trigger you send replaces the stored one, so read it with get_trigger first and send the whole thing back with your edits applied. Omitted fields are cleared, not preserved.
Inputs: trigger (required), account_id (required), trigger_id (required), container_id (required), +2 more. Returns: object
update_user_permissionUpdate User PermissionA
Change a user's access to a Tag Manager account.
The request replaces the stored access levels rather than merging into them, so send the complete accountAccess and containerAccess you want.
Inputs: account_id (required), permission_id (required), user_permission (required). Returns: object
update_variableUpdate VariableA
Update a variable in a workspace.
The variable you send replaces the stored one, so read it with get_variable first and send the whole thing back with your edits applied. Omitted fields are cleared, not preserved.
Inputs: variable (required), account_id (required), variable_id (required), container_id (required), +2 more. Returns: object
update_versionUpdate VersionA
Update a container version's name or notes.
Only the metadata is editable. A version's entities are a frozen snapshot; to change them, edit a workspace and create a new version.
Inputs: account_id (required), version_id (required), container_id (required), container_version (required), +1 more. Returns: object
update_workspaceUpdate WorkspaceC
Update a workspace's name or description.
Inputs: workspace (required), account_id (required), container_id (required), workspace_id (required), +1 more. Returns: object
update_zoneUpdate ZoneA
Update a zone in a workspace.
The zone you send replaces the stored one, so read it with get_zone first and send the whole thing back with your edits applied. Omitted fields are cleared, not preserved.
Inputs: zone (required), zone_id (required), account_id (required), container_id (required), +2 more. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 112 tools
The consistent list/get/create/update/delete/revert pattern makes most tools clearly distinct by entity. However, version-related tools (get_version, get_live_version, get_latest_version_header, set_latest_version) and publish-related tools (publish_version, publish_workspace, create_version) could be confused at a glance, though their descriptions disambiguate them well.
Tool names follow a strict verb_noun convention throughout, with consistent CRUD verbs (list/get/create/update/delete/revert) applied per entity. Exceptions like lookup_container, quick_preview_workspace, and summarize_container are also verb-first and clear, so the pattern remains predictable.
112 tools is an extreme count, far beyond the 50+ threshold for a score of 1. While the Google Tag Manager API is broad, exposing full CRUD for a dozen entity types plus many convenience helpers results in an overwhelming surface that would be difficult for an agent to navigate efficiently.
The surface covers the full lifecycle across accounts, permissions, containers, environments, versions, workspaces, and every workspace entity type (tags, triggers, variables, folders, templates, clients, transformations, zones, gtag configs). Convenience tools for searching, summarizing, and bulk operations close most practical gaps.
Maintenance
Related MCP Connectors
Read and edit GA4, Search Console and Google Tag Manager from any MCP client. 29 tools.
Let AI manage your Google Tag Manager containers — tags, triggers, variables, and more.
SEO & marketing toolkit for AI agents: GA4, Search Console, AdSense, GTM, PageSpeed, Trends.
A read-only verified record of agent-operable GTM tools: search, fetch, compare, track changes.
Related MCP Servers
- AlicenseBqualityDmaintenanceEnables comprehensive management of Google Tag Manager accounts, containers, workspaces, tags, triggers, and variables through OAuth2 authentication, allowing users to create, update, and publish GTM configurations via natural language.26MIT
- AlicenseNot gradedqualityAmaintenanceEnables interaction with Google Tag Manager through its API with built-in Google OAuth authentication. Allows managing GTM containers, tags, triggers, and variables through natural language.250Apache 2.0
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to manage Google Tag Manager accounts, containers, workspaces, tags, triggers, variables, and versions via the Tag Manager API v2.2Apache 2.0
- FlicenseNot gradedqualityCmaintenanceEnables MCP-compatible AI assistants to read and manage Google Tag Manager containers, tags, triggers, variables, and other GTM resources through the GTM API v2, with all processing running locally using the user's own Google credentials.-