Skip to main content
Glama
Samarth GTM MCP Server

Samarth GTM MCP Server

Official

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

NameRequiredDescriptionDefault
shaNoOptional gallery version SHA. Defaults to the latest published version.
ownerYesGitHub owner of the gallery template, e.g. "linkedin".
confirmYesMust be true to confirm this write operation.
accountIdYesThe GTM account ID.
repositoryYesGitHub repository, e.g. "linkedin-gtm-community-template".
containerIdYesThe GTM container ID.
workspaceIdYesThe GTM workspace ID.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv1.497.5
    • removedInput schema / additionalProperties
      Removed value: -false
    • addedInput schema / properties / accountId / pattern
      Added value: +"^\\d+$"
    • addedInput schema / properties / containerId / pattern
      Added value: +"^\\d+$"
    • addedInput schema / properties / workspaceId / pattern
      Added value: +"^\\d+$"
  2. Addedv1.472.0

TDQS

A4.8/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does: it declares the write, the GTM_MCP_ENABLE_WRITES=true and confirm=true preconditions, idempotent behavior (existing template returned unchanged, including hand-installed copies), fork resolution to the publisher, installation of unlisted vendor source, and SHA-256 pin verification at the reviewed commit. It even preempts a wrong claim about API support.

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?

Front-loaded with the [WRITE] marker and core purpose, and nearly every clause adds decision-relevant information. It is a single dense paragraph, though, and defensive lines like "never tell the user it is UI-only" plus the long tail of common pairs make it heavier than strictly necessary for selection.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 7-parameter write tool with no output schema, the description covers preconditions, idempotency, edge cases (forks, unlisted templates), and the return value ("Returns the installed template") plus the follow-up step of reading the cvt_ type. An agent has everything needed to call it correctly and to hand off to tags_create.

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?

Schema coverage is 100%, so the baseline is 3, but the description adds real meaning: it frames owner/repository as a GitHub pair with worked examples, implies sha pins a reviewed commit, and stresses reading the template's tag TYPE from the container rather than deriving it from templateId. It does not explain every parameter (e.g. how accountId/containerId/workspaceId scope the install), leaving that to the schema.

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?

"[WRITE] Install a Community Template Gallery template into a workspace by GitHub owner and repository" states a specific verb, resource, and the two addressing keys. It further distinguishes itself from templates_create (which builds the tag) and from native Google tag types, so an agent can pick it apart from siblings without opening a schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicit when-to-use (third-party pixel needing its official sandboxed template), when-not (GA4, Google Ads, Floodlight are native — no gallery repo, yields 404), and the alternative to use instead (tags_create with type "gaawe"). It also enumerates concrete owner/repository pairs for the most common cases, which is guidance no sibling list could supply.

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