templates_import_from_gallery
Install a Community Template Gallery template into a GTM workspace by GitHub owner and repository, so third-party pixels can use their official sandboxed template instead of Custom HTML.
Instructions
[WRITE] Install a Community Template Gallery template into a workspace by GitHub owner and repository, so a THIRD-PARTY pixel can use its official sandboxed template instead of Custom HTML. NOT for Google's own tags. GA4, Google Ads and Floodlight are BUILT IN to GTM as native tag types (googtag, gaawe, awct, sp, flc), there is no gallery repository for them, and asking for one answers "404 Not found or permission denied". To build a GA4 event tag call tags_create with type "gaawe" directly; do not import anything first. Requires GTM_MCP_ENABLE_WRITES=true and confirm=true. The GTM API DOES support this (templates.import_from_gallery); never tell the user it is UI-only. Idempotent: one already present is returned unchanged rather than duplicated, including a copy installed by hand. Handles the two cases a plain gallery import cannot: a repo that is only a FORK is imported from the publisher instead, and a template the gallery never listed (e.g. stape-io/data-client, rtb-house-tag, tapfiliate-tag) is installed by uploading the vendor source, which is what Templates > Import does by hand. That source is fetched only at the commit pinned as reviewed and refused unless its SHA-256 matches the pin. Returns the installed template. To build a tag on it you need its tag TYPE (a cvt_... string): READ that from the container rather than constructing it from the templateId, because the format is not what it appears to be. Pass the exact string as type to tags_create along with that template's own field keys (template-specific, e.g. Meta Pixel uses pixelId). Common pairs: facebook/GoogleTagManager-WebTemplate-For-FacebookPixel (Meta Pixel), tiktok/gtm-template-pixel (TikTok), linkedin/linkedin-gtm-community-template (LinkedIn Insight Tag 2.0), Snapchat/snapchat-google-tag-manager (Snap Pixel), pinterest/ws-gtm-template (Pinterest, web) or pinterest/ss-gtm-template (Pinterest, server), stape-io/facebook-tag and stape-io/tiktok-tag (Stape server-side).
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>",
"owner": "<owner>",
"repository": "<repository>",
"confirm": "<confirm>"
},
"name": "templates_import_from_gallery"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sha | No | Optional gallery version SHA. Defaults to the latest published version. | |
| owner | Yes | GitHub owner of the gallery template, e.g. "linkedin". | |
| confirm | Yes | Must be true to confirm this write operation. | |
| accountId | Yes | The GTM account ID. | |
| repository | Yes | GitHub repository, e.g. "linkedin-gtm-community-template". | |
| containerId | Yes | The GTM container ID. | |
| workspaceId | Yes | The GTM workspace ID. |