evaluate_rule
MCP tool that runs a single rule against a container and returns the full finding, with every affected item.
On this page 6
Summary
- tool —
evaluate_rule - purpose — run one rule against a container; return the full finding
- rest equivalent —
POST /v1/evaluate-rule(the REST response also carriesevaluated_atandduration_ms) - rate limit — 500/day per user
- synchronous — yes
Runs a single rule against a container and returns the finding as the rule engine produced it: every affected item and the evidence, nothing trimmed. Use it to check one rule on a site, to look closer at a finding from scan_url, or to confirm a fix after a container change.
When to use it
Use evaluate_rule when you already know which rule you care about.
- vs
scan_url—scan_urlruns all rules and returns thin findings: the first 3 affected items and no evidence.evaluate_ruleruns one rule and returns the completeaffectedItemslist and theevidence. Start withscan_url, then callevaluate_ruleon the finding you want to look at. - vs
list_rulesandget_rule— those read rule metadata and never touch a container.evaluate_ruleruns the rule. To find the rightrule_id, calllist_rulesfirst.
Arguments
| Argument | Type | Required | Description |
|---|---|---|---|
rule_id | string | required | Rule ID to run (for example ga4-pii-parameter-names). Use list_rules to find IDs. |
url | string | one of | Address of the page whose container to check. A full URL (https://example.com), a bare domain (example.com, scanned over https), or a GTM ID (GTM-XXXXX) are all accepted. The tool's own schema says "Full URL"; the other two forms work as well. |
gtm_id | string | one of | GTM container ID (GTM-XXXXX, upper case). The page is not fetched. |
data | object | one of | A GTM JSON export as downloaded from GTM, or container data already parsed by TagManifest. Nothing is fetched. |
One of url, gtm_id, or data is needed alongside rule_id. If data is present it is used and the other two are ignored.
Synchronous. The tool returns when the rule has run. 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:
| Field | Meaning |
|---|---|
rule_id | The rule that ran. |
fired | true when the rule produced at least one finding. |
finding_count | The number of findings. 0 when the rule did not fire. |
findings | The findings, as the rule engine produced them. Empty when the rule did not fire. |
container | gtm_id, tag_count, and from_cache. gtm_id is read from the container. When a parsed container in data carries no ID, a gtm_id passed in the same call is used; with neither, it is null. |
Findings here are not the thin findings that scan_url returns. The field names are the rule engine's own, in camelCase: ruleId, severity, category, title, description, affectedItems, evidence, recommendation, action, tier. affectedItems holds the affected items the rule reports (some rules list only the first 10 or 20). The shape of each affected item and of evidence depends on the 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.
{
"rule_id": "ga4-pii-parameter-names",
"fired": true,
"finding_count": 1,
"findings": [
{
"ruleId": "ga4-pii-parameter-names",
"severity": "critical",
"category": "ga4",
"title": "GA4 parameters with PII-suggesting names",
"description": "1 GA4 tags include parameters with names suggesting personally identifiable information (email, phone, name, etc.). Sending PII to GA4 violates Google's Terms of Service and may violate privacy regulations.",
"affectedItems": [
{ "id": "2", "name": "GA4 - Contact form", "piiParams": ["email"] }
],
"evidence": [
{
"tagId": "2",
"params": [
{ "name": "email", "value": "jane@example.com..." }
]
}
],
"recommendation": "Remove PII parameters, or hash them with SHA-256 before sending. Ensure any user-provided data sent to GA4 is properly anonymized.",
"action": "Remove or hash PII data",
"tier": "error"
}
],
"container": {
"gtm_id": "GTM-EXAMPLE",
"tag_count": 4,
"from_cache": false
}
}
When the rule does not fire, the result is "fired": false, "finding_count": 0 and an empty findings list.
Errors
- Bad arguments come back as a JSON-RPC error with code
-32602. This covers a missingrule_id, an argument the tool does not accept (the message suggests the nearest name), and an argument of the wrong type.category,tierandtop_nare not arguments of this tool. These are checked before the rate limit, so they do not count against it. - A run that fails comes back as a normal tool result with
isError: trueand a plain message in the text block. Examples: arule_idthat does not exist (Unknown rule_id: …), none ofurl,gtm_idordatagiven, a page with no GTM snippet, or a GTM ID that Google has no public container for. 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 evaluate_rule: 501/500. 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:
- "Check rule
ga4-pii-parameter-namesagainst example.com. Did it fire?" - "I added a Conversion Linker. Re-run
missing-conversion-linkeron GTM-XXXXX and tell me if it still flags." - "Show me every tag that
eval-usageflags in this export."
For agents wired to your own application:
You have access to TagManifest's MCP server. Use the evaluate_rule
tool to run a single audit rule against a GTM container and return
the complete finding. The tool requires a rule_id plus one of url,
gtm_id, or data. It returns fired (boolean), finding_count, the full
findings array with all affectedItems, and a container summary.
See also
- scan_url — run all rules against a container; returns thin findings
- list_rules — browse the rule catalog to find rule IDs
- Health score — how rule findings combine into the container score
Examples
{
"tool": "evaluate_rule",
"arguments": {
"rule_id": "ga4-pii-parameter-names",
"url": "https://example.com"
}
}
{
"rule_id": "ga4-pii-parameter-names",
"fired": true,
"finding_count": 1,
"findings": [
{
"ruleId": "ga4-pii-parameter-names",
"severity": "critical",
"category": "ga4",
"title": "GA4 parameters with PII-suggesting names",
"description": "1 GA4 tags include parameters with names suggesting personally identifiable information…",
"affectedItems": [
{ "id": "2", "name": "GA4 - Contact form", "piiParams": ["email"] }
],
"evidence": [ /* per-tag detail */ ],
"recommendation": "Remove PII parameters, or hash them with SHA-256 before sending…",
"action": "Remove or hash PII data",
"tier": "error"
}
],
"container": {
"gtm_id": "GTM-EXAMPLE",
"tag_count": 4,
"from_cache": false
}
}