Ask a report over MCP
An agent can ask which lab was viewed most by calling example_report. The player below is a labeled example. The live tool is seeded and is not a GA4 property.
Understanding the labHow to use it and why you'd want to
Why you'd want to
You want an agent to answer which page was viewed most. The numbers on this page are an example, not a live property.
How to use it
- Accept, then press Next through the report.
- Read the dimensions, the metric, and the rows.
- Notice the example label on the table.
- Open How we built it for the event name.
WalkthroughHow we built itShowHide
Example vendor setup is marked below. eVar and event numbers are examples. This lab does not call Adobe.
The analytics MCP lab plays an example run_report table. It does not connect to a live GA4 property. After Accept it queues analytics_mcp_report with the tool name only. The lab does not call Adobe.
Show the example
The shared MCP view renders the request, the response, the timeline, and the answer. The trace is labeled as an example.
Stay read-only
Navigation and tools stay on this origin. There is no form submit and no write tool.
Queue the name only
After Accept, demonstrateEvent sends the lab event. When a tool ran, the only parameter is tool. The question text is not a parameter.
Skip the event before Accept
The Next button still moves the example when consent is off. demonstrateEvent returns without pushing.
From the code
After Accept, the step queues its event. A tool name is the only extra field.
function go(next: number) {
const target = steps[next]
if (!target) return
setIndex(next)
const eventName = target.event
if (granted && eventName) {
const tool = target.tool
demonstrateEvent(eventName, tool ? { tool } : {})Consent off still lets the example move. The event is skipped.
{granted ? null : (
<p className="mt-3 rounded-lg border px-3 py-2 text-sm">{tr(locale, "Accept measurement to record the step. The example still moves. Nothing is pushed before Accept.", "Acepta la medición para registrar el paso. El ejemplo igual avanza. No se envía nada antes de Aceptar.")}</p>Google and Adobe
Google queues analytics_mcp_report after Accept. Adobe is an example of the same fields.
After Accept, this lab queues analytics_mcp_report. When a tool ran, the parameter is tool and nothing else. The question and the answer text are not parameters. This site does not call gtag('set') or Adobe.
Simplified shape of the object queued after Accept. Register any new parameter as an event-scoped custom dimension. This site does not call gtag('set').
dataLayer.push({
event: "analytics_mcp_report",
tool: "run_report",
})Example implementation. This site does not call Adobe. eVar120, prop120, and event120 are example variable numbers. In Launch, a data element reads the value and a rule sends it when the value changes. In the report suite, enable eVar120 with Most Recent allocation and expire it on the hit. A processing rule is unnecessary if the data element maps straight to that eVar.
Example alloy payload. _example is a placeholder schema, not a real tenant.
alloy("sendEvent", {
xdm: {
eventType: "web.webinteraction.linkClicks",
_example: {
mcpTool: "run_report",
},
},
})Example hit. eVar120 is hit-scoped in this example. prop120 dies at the same hit.
s.eVar120 = "run_report"
s.prop120 = "run_report"
s.events = "event120"
s.linkTrackVars = "eVar120,prop120,events"
s.linkTrackEvents = "event120"
s.tl(true, "o", "analytics_mcp_report")Translation
Each lab field, the GA4 name, and the example Adobe variable. Scope is the part that usually gets lost in the translation.
Step
GA4. Event analytics_mcp_report after Accept.
Adobe. Example event120. This site does not call Adobe.
Scope. Event. It records that the step was shown.
Tool name
GA4. Parameter tool. The arguments are not sent.
Adobe. Example eVar120, expire on the hit. This site does not call Adobe.
Scope. Event. A user property would keep the last tool.
Question text
GA4. Not sent.
Adobe. Do not put the question in a prop. Not sent.
Scope. It stays on the page.
Consent
GA4. Not a parameter. The push is skipped until Accept.
Adobe. Example: skip the hit while consent is off.
Scope. A gate on the hit.
Example report
Accept measurement to record the step. The example still moves. Nothing is pushed before Accept.
Ask
Example question: which lab was viewed most this week. The words are not sent.
Response
Move forward to see this result.
A later connection could run a read-only GA4 report on the server, with the property id in an allowlist and no metric id in the page. This lab does not open that connection. Cost stays at the recorded JSON, a fraction of a cent per view, until a live report is added.
Recommended next
Why these picksReading path transitions…