scan_url
MCP tool that audits a GTM container by page address or GTM ID. Synchronous.
Summary
- tool —
scan_url - purpose — audit a GTM container by page address or GTM ID; fetches and parses the public container
- rest equivalent —
POST /v1/scan-url(same rule engine; the result differs, see Differences from REST) - rate limit — 100/day per user
- synchronous — yes
The MCP tool that audits a public page or a known GTM ID. It runs the same rule engine as the POST /v1/scan-url REST endpoint. The result is not the same shape as the REST response: it is shorter, and the totals come first.
When to use it
The default audit tool. If a user mentions a website or a GTM ID, the agent should call scan_url. For a GTM JSON export that is already in the conversation, use scan_container. To run one named rule, use evaluate_rule.
Arguments
| Argument | Type | Required | Description |
|---|---|---|---|
url | string | one of | Address of the page to audit, for example https://example.com. A bare domain such as example.com is scanned over https. A GTM ID given here (GTM-XXXXX) is treated as a GTM ID. The tool fetches the page, finds the GTM container ID in its HTML, and scans that container. |
gtm_id | string | one of | GTM container ID (GTM-XXXXX, upper case). Use it when you already know the ID. The page is not fetched. |
category | string | optional | Return only findings in one category: consent, ga4, ads, ecommerce, security, pii, performance, quality, organization, dead-code. |
tier | string | optional | Return only findings in one tier: error, warning, optimization, info. |
top_n | number | optional | Maximum findings to return, most important first (by tier, then severity). Default 25. 0 returns the totals and no findings. |
Either url or gtm_id is required.
The tool also accepts data (a GTM JSON export or a parsed container), although the tool's schema does not list it. data only works alongside url or gtm_id. When it is present, the container in data is scanned and nothing is fetched. To scan a container you already hold, call scan_container instead.
Synchronous. The tool returns when the scan completes. No polling, no webhooks. A fetched container is reused for up to five minutes, so a repeat scan of the same GTM ID skips the fetch from Google.
Returns
The tool result is one text block. Its text is a JSON object with these fields, in this order:
| Field | Meaning |
|---|---|
container | gtm_id, name, tag_count, trigger_count, variable_count, and from_cache. |
health_score | The full score object: score, grade, label, deductions, caps, functionalIssueCount. Always describes the whole container. |
findings_total | The number of findings. With a category or tier filter, the number that match the filter. |
findings_shown | How many findings the findings list holds. |
findings_truncated | true when findings_total is larger than findings_shown. |
by_category, by_tier | Counts of all findings in the container. Filters do not change them. |
findings | Thin findings, most important first: by tier (error, warning, optimization, info), then by severity. |
Each finding carries rule_id, title, severity, tier, category, finding_count, affected_items (the first 3), affected_items_total, action, and recommendation. The title, severity and tier are the ones that apply to this container. For the rule's catalogue entry, call get_rule. For the full list of affected items, call evaluate_rule.
Caching. On MCP the cache field is container.from_cache. It is true when a stored copy of the container was used, false when the container was fetched from Google, and null when the container came from data.
The example below is the result for a small test container with ten findings, called with top_n: 3.
Full result
{
"container": {
"gtm_id": "GTM-EXAMPLE",
"name": "Example container",
"tag_count": 4,
"trigger_count": 1,
"variable_count": 0,
"from_cache": false
},
"health_score": {
"score": 49,
"grade": "D",
"label": "Patterns Found",
"deductions": {
"error": 32,
"warning": 8,
"optimization": 11,
"info": 0,
"byCategory": {
"ga4": 3,
"security": 2,
"ads": 2,
"consent": 2
}
},
"caps": {
"error": 35,
"warning": 20,
"optimization": 25,
"info": 0
},
"functionalIssueCount": 9
},
"findings_total": 10,
"findings_shown": 3,
"findings_truncated": true,
"by_category": {
"ga4": 4,
"security": 2,
"ads": 2,
"consent": 2
},
"by_tier": {
"error": 4,
"warning": 2,
"optimization": 3,
"info": 1
},
"findings": [
{
"rule_id": "ga4-param-pii-risk",
"title": "GA4 event parameters with PII-risk names",
"severity": "critical",
"tier": "error",
"category": "ga4",
"finding_count": 1,
"affected_items": [
{ "id": "2", "name": "GA4 - Contact form", "piiParams": ["email"] }
],
"affected_items_total": 1,
"action": "Remove PII parameters",
"recommendation": "Remove PII parameters entirely, or rename them to non-PII names and hash the values with SHA-256 before sending."
},
{
"rule_id": "ga4-pii-parameter-names",
"title": "GA4 parameters with PII-suggesting names",
"severity": "critical",
"tier": "error",
"category": "ga4",
"finding_count": 1,
"affected_items": [
{ "id": "2", "name": "GA4 - Contact form", "piiParams": ["email"] }
],
"affected_items_total": 1,
"action": "Remove or hash PII data",
"recommendation": "Remove PII parameters, or hash them with SHA-256 before sending. Ensure any user-provided data sent to GA4 is properly anonymized."
},
{
"rule_id": "eval-usage",
"title": "eval() usage detected",
"severity": "high",
"tier": "error",
"category": "security",
"finding_count": 1,
"affected_items": [
{ "id": "4", "name": "Legacy chat widget" }
],
"affected_items_total": 1,
"action": "Remove eval() usage",
"recommendation": "Refactor to avoid eval(). Use JSON.parse() for data, or restructure the logic to avoid dynamic code execution."
}
]
}
In health_score, caps is the most each tier can take off the score: 35 for errors, 20 for warnings, 25 for optimizations, 0 for info. deductions.byCategory counts the findings that fed the score in each category. It is a count, not points. See Health score.
Differences from REST
scan_url and POST /v1/scan-url run the same rules on the same container. The answers differ in these ways:
MCP scan_url | REST POST /v1/scan-url | |
|---|---|---|
top_n when left out | 25 findings | all findings |
findings_shown | present | not present |
scanned_at, duration_ms | not present | present |
site object | not present | present (url, gtm_id, from_cache) |
| Cache field | container.from_cache | site.from_cache |
| Field order | health_score and totals before findings | findings before health_score |
include_evidence | not accepted | accepted |
Bare domain or GTM ID in url | accepted | refused: url must be a full http(s) URL |
| Rate-limit headers | none | X-RateLimit-* on responses to counted requests |
Errors
- Bad arguments come back as a JSON-RPC error with code
-32602. This covers an argument the tool does not accept (for examplecategoriesforcategory; the message suggests the nearest name), acategoryortiervalue that does not exist, atop_nthat is negative or not a number, and an argument of the wrong type. These are checked before the rate limit, so they do not count against it. - A scan that fails comes back as a normal tool result with
isError: trueand a plain message in the text block. Examples: neitherurlnorgtm_idwas given, the page has no GTM snippet or could not be fetched, the GTM ID is not in theGTM-XXXXXformat, or Google has no public container with that ID. These calls do count against the rate limit. - Rate limit comes back as a JSON-RPC error with code
-32603and the messageRate limit exceeded for scan_url: 101/100. Resets at <time>.The HTTP status is 200. MCP responses carry noX-RateLimit-*headers. The limit resets at midnight UTC.
Try saying
Natural-language prompts that route to this tool through an agent:
- "Audit example.com for consent issues."
- "Check the GTM setup at https://example.com."
- "Scan GTM-XXXXX and show me only the errors."
For agents wired to your own application:
You have access to TagManifest's MCP server. Use the scan_url tool
to audit a website or GTM container by URL or GTM ID. The tool
requires either a `url` or `gtm_id` and optionally accepts `category`,
`tier`, and `top_n` (default 25). The result starts with the health
score and findings_total, then lists findings most important first
(by tier, then severity).
See also
- scan_container — audit a GTM JSON export you already have in hand
- evaluate_rule — run a single rule and get every affected item
- Health score — how findings translate to the score
Examples
{
"tool": "scan_url",
"arguments": {
"url": "https://example.com",
"top_n": 3
}
}
{
"container": {
"gtm_id": "GTM-EXAMPLE",
"name": "Example container",
"tag_count": 4,
"trigger_count": 1,
"variable_count": 0,
"from_cache": false
},
"health_score": {
"score": 49,
"grade": "D",
"label": "Patterns Found",
"deductions": {
"error": 32,
"warning": 8,
"optimization": 11,
"info": 0,
"byCategory": {
"ga4": 3,
"security": 2,
"ads": 2,
"consent": 2
}
},
"caps": {
"error": 35,
"warning": 20,
"optimization": 25,
"info": 0
},
"functionalIssueCount": 9
},
"findings_total": 10,
"findings_shown": 3,
"findings_truncated": true,
"by_category": {
"ga4": 4,
"security": 2,
"ads": 2,
"consent": 2
},
"by_tier": {
"error": 4,
"warning": 2,
"optimization": 3,
"info": 1
},
"findings": [
{
"rule_id": "ga4-param-pii-risk",
"title": "GA4 event parameters with PII-risk names",
"severity": "critical",
"tier": "error",
"category": "ga4",
"finding_count": 1,
"affected_items": [
{
"id": "2",
"name": "GA4 - Contact form",
"piiParams": [
"email"
]
}
],
"affected_items_total": 1,
"action": "Remove PII parameters",
"recommendation": "Remove PII parameters entirely, or rename them to non-PII names and hash the values with SHA-256 before sending."
},
{
"rule_id": "ga4-pii-parameter-names",
"title": "GA4 parameters with PII-suggesting names",
"severity": "critical",
"tier": "error",
"category": "ga4",
"finding_count": 1,
"affected_items": [
{
"id": "2",
"name": "GA4 - Contact form",
"piiParams": [
"email"
]
}
],
"affected_items_total": 1,
"action": "Remove or hash PII data",
"recommendation": "Remove PII parameters, or hash them with SHA-256 before sending. Ensure any user-provided data sent to GA4 is properly anonymized."
},
{
"rule_id": "eval-usage",
"title": "eval() usage detected",
"severity": "high",
"tier": "error",
"category": "security",
"finding_count": 1,
"affected_items": [
{
"id": "4",
"name": "Legacy chat widget"
}
],
"affected_items_total": 1,
"action": "Remove eval() usage",
"recommendation": "Refactor to avoid eval(). Use JSON.parse() for data, or restructure the logic to avoid dynamic code execution."
}
]
}