Skip to main content
TagManifest /Docs Dashboard

compare_containers

MCP tool that diffs two containers and returns each health score, the score difference, and the findings unique to A, unique to B, and shared.

On this page 6

Summary

  • tool — compare_containers
  • purpose — diff two GTM containers; returns each health score, the difference, and the findings unique to each side and shared
  • rest equivalent — none (MCP only)
  • rate limit — 30/day per user (each call scans two containers and counts once)
  • synchronous — yes

Diffs two containers. Each call scans both sides at the same time. Each side can be a page address, a GTM ID, or a GTM JSON export.

TOOLcompare_containers

When to use it

Use compare_containers when the question is about the difference between two containers: staging against production, one site against another, or an export from before a change against one from after.

The tool keeps no history. To compare before and after, you need both containers: two exports, or two GTM IDs. For one container, use scan_url. To run one named rule, use evaluate_rule.

Arguments

Both a and b are required. Each is an object that names one container.

ArgumentTypeRequiredDescription
aobjectrequiredThe first container. Holds one of url, gtm_id, or data.
bobjectrequiredThe second container. Holds one of url, gtm_id, or data.
a.url, b.urlstringone ofAddress of the page. A full URL (https://example.com), a bare domain (example.com, scanned over https), or a GTM ID (GTM-XXXXX) are all accepted.
a.gtm_id, b.gtm_idstringone ofGTM container ID (GTM-XXXXX, upper case). The page is not fetched.
a.data, b.dataobjectone ofA GTM JSON export as downloaded from GTM, or container data already parsed by TagManifest. Nothing is fetched.
top_nnumberoptionalHow many findings to list in each of a_only, b_only and shared. Default 10. The totals always count every finding.

Each of a and b needs one of url, gtm_id, or data. If data is present it is used and the other two are ignored.

Synchronous. Both scans run at the same time and the tool returns when both complete. No polling, no webhooks. A fetched container is reused for up to five minutes.

Returns

The tool result is one text block. Its text is a JSON object with these fields, in this order:

FieldMeaning
a, bFor each side: gtm_id, total_findings, health_score (the 0–100 number), and grade.
health_deltaScore of B minus score of A. A positive value means B is healthier.
a_only_total, b_only_total, shared_totalHow many findings are in each group.
a_onlyFindings whose rule fired in A and not in B.
b_onlyFindings whose rule fired in B and not in A.
sharedFindings whose rule fired in both. The details shown are from A.

Two findings match when they have the same rule_id. Each list holds the first top_n findings of its group (10 by default), most important first: by tier, then severity. Each finding is a short line with rule_id, title, severity, tier, category, and affected_items_total. Call get_rule for the fix, or evaluate_rule for the affected items.

The example below compares two small test containers, called with top_n: 3. Container B has two security findings fixed and a Conversion Linker added.

{
  "a": {
    "gtm_id": "GTM-EXAMPLE",
    "total_findings": 10,
    "health_score": 49,
    "grade": "D"
  },
  "b": {
    "gtm_id": "GTM-EXAMPLE2",
    "total_findings": 8,
    "health_score": 69,
    "grade": "C"
  },
  "health_delta": 20,
  "a_only_total": 3,
  "b_only_total": 1,
  "shared_total": 7,
  "a_only": [
    {
      "rule_id": "eval-usage",
      "title": "eval() usage detected",
      "severity": "high",
      "tier": "error",
      "category": "security",
      "affected_items_total": 1
    },
    {
      "rule_id": "http-script-loading",
      "title": "HTTP (non-secure) resource loading detected",
      "severity": "high",
      "tier": "error",
      "category": "security",
      "affected_items_total": 1
    },
    {
      "rule_id": "missing-conversion-linker",
      "title": "Google Ads tags present but no Conversion Linker tag",
      "severity": "critical",
      "tier": "warning",
      "category": "ads",
      "affected_items_total": 1
    }
  ],
  "b_only": [
    {
      "rule_id": "naming-default-names",
      "title": "Tags or triggers with default/placeholder names",
      "severity": "medium",
      "tier": "info",
      "category": "organization",
      "affected_items_total": 1
    }
  ],
  "shared": [
    {
      "rule_id": "ga4-param-pii-risk",
      "title": "GA4 event parameters with PII-risk names",
      "severity": "critical",
      "tier": "error",
      "category": "ga4",
      "affected_items_total": 1
    },
    {
      "rule_id": "ga4-pii-parameter-names",
      "title": "GA4 parameters with PII-suggesting names",
      "severity": "critical",
      "tier": "error",
      "category": "ga4",
      "affected_items_total": 1
    },
    {
      "rule_id": "consent-no-cmp",
      "title": "Ad/tracking tags present with no consent configuration and no CMP",
      "severity": "high",
      "tier": "warning",
      "category": "consent",
      "affected_items_total": 1
    }
  ]
}

Here shared_total is 7 and the shared list holds 3, because top_n was 3.

Errors

  • Bad arguments come back as a JSON-RPC error with code -32602. This covers a missing a or b, a top-level argument the tool does not accept, an a or b that is not an object, and a top_n that is negative or not a number. category and tier are not arguments of this tool. These are checked before the rate limit, so they do not count against it.
  • A comparison that fails comes back as a normal tool result with isError: true and a plain message in the text block. Examples: a side with none of url, gtm_id or data, a page with no GTM snippet, or a GTM ID that Google has no public container for. If either side fails, the whole call fails. These calls do count against the rate limit.
  • Rate limit comes back as a JSON-RPC error with code -32603 and the message Rate limit exceeded for compare_containers: 31/30. Resets at <time>. The HTTP status is 200. MCP responses carry no X-RateLimit-* headers. The limit resets at midnight UTC.

Try saying

Natural-language prompts that route to this tool through an agent:

  • "Compare GTM-AAAAAAA with GTM-BBBBBBB. Which is healthier?"
  • "What differs between the containers on staging.example.com and example.com?"
  • "Here are two exports, from before and after my change. What did the change fix?"

For agents wired to your own application:

You have access to TagManifest's MCP server. Use the compare_containers
tool to diff two GTM containers. The tool requires both an `a` and a `b`
argument, each holding a `url`, `gtm_id`, or `data` field. It returns
each side's health score and grade, a `health_delta` (score B minus
score A), and `a_only`, `b_only`, and `shared` finding lists (the first
10 of each, with `*_total` counts). Use it when the user asks how two
containers differ.

See also

  • scan_url — single-container audit; use this when you need one side, not a diff
  • evaluate_rule — run one rule against a container
  • Health score — how to read health_score, grade, and health_delta

Examples

MCP tool call
{
  "tool": "compare_containers",
  "arguments": {
    "a": { "url": "https://staging.example.com" },
    "b": { "url": "https://example.com" },
    "top_n": 3
  }
}
Tool result
{
  "a": {
    "gtm_id": "GTM-EXAMPLE",
    "total_findings": 10,
    "health_score": 49,
    "grade": "D"
  },
  "b": {
    "gtm_id": "GTM-EXAMPLE2",
    "total_findings": 8,
    "health_score": 69,
    "grade": "C"
  },
  "health_delta": 20,
  "a_only_total": 3,
  "b_only_total": 1,
  "shared_total": 7,
  "a_only": [
    {
      "rule_id": "eval-usage",
      "title": "eval() usage detected",
      "severity": "high",
      "tier": "error",
      "category": "security",
      "affected_items_total": 1
    },
    {
      "rule_id": "http-script-loading",
      "title": "HTTP (non-secure) resource loading detected",
      "severity": "high",
      "tier": "error",
      "category": "security",
      "affected_items_total": 1
    },
    {
      "rule_id": "missing-conversion-linker",
      "title": "Google Ads tags present but no Conversion Linker tag",
      "severity": "critical",
      "tier": "warning",
      "category": "ads",
      "affected_items_total": 1
    }
  ],
  "b_only": [
    {
      "rule_id": "naming-default-names",
      "title": "Tags or triggers with default/placeholder names",
      "severity": "medium",
      "tier": "info",
      "category": "organization",
      "affected_items_total": 1
    }
  ],
  "shared": [
    {
      "rule_id": "ga4-param-pii-risk",
      "title": "GA4 event parameters with PII-risk names",
      "severity": "critical",
      "tier": "error",
      "category": "ga4",
      "affected_items_total": 1
    },
    {
      "rule_id": "ga4-pii-parameter-names",
      "title": "GA4 parameters with PII-suggesting names",
      "severity": "critical",
      "tier": "error",
      "category": "ga4",
      "affected_items_total": 1
    },
    {
      "rule_id": "consent-no-cmp",
      "title": "Ad/tracking tags present with no consent configuration and no CMP",
      "severity": "high",
      "tier": "warning",
      "category": "consent",
      "affected_items_total": 1
    }
  ]
}