Skip to main content
Glama
ambit1977

Google Tag Manager MCP Server

by ambit1977

get_tag

Retrieve detailed configuration and settings for a specific tag in Google Tag Manager to review or modify tracking implementations.

Instructions

指定されたタグの詳細を取得します

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
accountIdYesアカウントID
containerIdYesコンテナID
workspaceIdYesワークスペースID
tagIdYesタグID

Implementation Reference

  • Handler logic for the 'get_tag' tool in the MCP server's CallToolRequestHandler. It calls the GTMClient's getTag method with the provided accountId, containerId, workspaceId, and tagId, then returns the JSON-formatted response.
    case 'get_tag':
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(
              await this.gtmClient.getTag(
                args.accountId,
                args.containerId,
                args.workspaceId,
                args.tagId
              ),
              null,
              2
            ),
          },
        ],
      };
  • Input schema definition for the 'get_tag' tool, specifying required string parameters: accountId, containerId, workspaceId, tagId.
    inputSchema: {
      type: 'object',
      properties: {
        accountId: {
          type: 'string',
          description: 'アカウントID',
        },
        containerId: {
          type: 'string',
          description: 'コンテナID',
        },
        workspaceId: {
          type: 'string',
          description: 'ワークスペースID',
        },
        tagId: {
          type: 'string',
          description: 'タグID',
        },
      },
      required: ['accountId', 'containerId', 'workspaceId', 'tagId'],
    },
  • src/index.js:202-227 (registration)
    Registration of the 'get_tag' tool in the list of tools returned by ListToolsRequestHandler, including name, description, and input schema.
    {
      name: 'get_tag',
      description: '指定されたタグの詳細を取得します',
      inputSchema: {
        type: 'object',
        properties: {
          accountId: {
            type: 'string',
            description: 'アカウントID',
          },
          containerId: {
            type: 'string',
            description: 'コンテナID',
          },
          workspaceId: {
            type: 'string',
            description: 'ワークスペースID',
          },
          tagId: {
            type: 'string',
            description: 'タグID',
          },
        },
        required: ['accountId', 'containerId', 'workspaceId', 'tagId'],
      },
    },
  • Supporting method in GTMClient class that performs the actual Google Tag Manager API call to retrieve tag details using the tagmanager service.
    async getTag(accountId, containerId, workspaceId, tagId) {
      await this.ensureAuth();
      const response = await this.tagmanager.accounts.containers.workspaces.tags.get({
        path: `accounts/${accountId}/containers/${containerId}/workspaces/${workspaceId}/tags/${tagId}`
      });
      return response.data;
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ambit1977/GTM-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server