compute_metrics
Calculates exact marketing totals, percentage changes, CTR, CPC, CPA, ROAS, goal progress, top movers, and anomalies from GA4, Google Ads, Meta Ads, or CSV/JSON data for report writing.
Instructions
Compute exact report metrics from marketing data: totals, % change vs previous period or last year, CTR, CPC, CPA, ROAS and rates recomputed from totals (never averaged), blended ad totals, goal progress, top movers and anomalies, with ready-to-print display strings. Use these numbers when writing a report.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "compute_metrics"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| end | No | Current period end, YYYY-MM-DD. | |
| data | No | JSON sources: [{name, rows}] with plain row objects, [{name, ga4_report}] with a GA4 runReport response unchanged, or [{name, google_ads}] with a Google Ads search/searchStream response unchanged. | |
| files | No | CSV exports: [{name, content}] (content = CSV text). Use content_base64 for UTF-16 files. | |
| goals | No | Targets, e.g. {"conversions": 150, "cpa@blended": 40}. | |
| start | No | Current period start, YYYY-MM-DD. Omit to use the latest complete month. | |
| compare | No | Compare with the previous period (default) or the same period last year. | |
| currency | No | 3-letter currency code if the data doesn't say, e.g. USD or INR. | |
| number_style | No | indian = lakh/crore grouping. |