Skip to main content
Glama
ambit1977

Google Tag Manager MCP Server

by ambit1977

delete_variable

Remove a variable from Google Tag Manager by specifying account, container, workspace, and variable IDs to clean up configurations.

Instructions

変数を削除します

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
accountIdYesアカウントID
containerIdYesコンテナID
workspaceIdYesワークスペースID
variableIdYes変数ID

Implementation Reference

  • MCP tool execution handler for 'delete_variable'. Extracts arguments and calls GTMClient.deleteVariable, returning the result as formatted JSON text content.
    case 'delete_variable':
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(
              await this.gtmClient.deleteVariable(
                args.accountId,
                args.containerId,
                args.workspaceId,
                args.variableId
              ),
              null,
              2
            ),
          },
        ],
      };
  • Tool schema definition including input schema for 'delete_variable' provided in the listTools response.
    {
      name: 'delete_variable',
      description: '変数を削除します',
      inputSchema: {
        type: 'object',
        properties: {
          accountId: {
            type: 'string',
            description: 'アカウントID',
          },
          containerId: {
            type: 'string',
            description: 'コンテナID',
          },
          workspaceId: {
            type: 'string',
            description: 'ワークスペースID',
          },
          variableId: {
            type: 'string',
            description: '変数ID',
          },
        },
        required: ['accountId', 'containerId', 'workspaceId', 'variableId'],
      },
    },
  • Core implementation in GTMClient that authenticates and calls the Google Tag Manager API to delete the specified variable.
    async deleteVariable(accountId, containerId, workspaceId, variableId) {
      await this.ensureAuth();
      await this.tagmanager.accounts.containers.workspaces.variables.delete({
        path: `accounts/${accountId}/containers/${containerId}/workspaces/${workspaceId}/variables/${variableId}`
      });
      return { success: true };
    }

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