What it does
Compare a metric between two periods. Volume metric — counts include AI-mediated human browsing (ai_user_action).
Example prompts
Ask:
"Compare last 7 days vs the previous 7 days for mysite.com."
"How does this month look compared to last month?"
"Pageviews trend week-over-week."
A typical response:
Pageviews, last 7 days vs previous 7 days:
Period A (May 12-18): 42,180
Period B (May 5-11): 31,420
Change: +34.2%
Absolute delta: +10,760
Best day in A: May 16 (8,114 views)
Best day in B: May 9 (5,847 views)
Returns a single object with both period values, the percentage and absolute delta, and bucket info if the period is sub-week granularity.
Period strings the parser understands:
last_7_days,last_30_days,last_90_daysprevious_7_days,previous_30_daysthis_week,last_week,this_month,last_monthlast_24_hours,last_hourYYYY-MM-DD..YYYY-MM-DDfor explicit ranges
Volume metric: counts include AI-mediated human browsing. If you want
to compare only direct browser traffic, you can filter using
traffic_class_breakdown for each period instead.
Common workflow: pair with
top_pages on both
periods to identify pages driving the change.
Arguments
| Name | Type | Required | Description / Default |
|---|---|---|---|
site_id |
string | required | Site identifier from list_sites (8-character base32, e.g. 'wjxayhdd'). |
metric |
string enum: pageviews, visitors, sessions |
required | Metric to compare across periods. Volume metric, includes AI-mediated human browsing. |
period_a |
string | required | First period (same format as `period` elsewhere). Returned as a_value. |
period_b |
string | required | Second period to compare against (same format). Returned as b_value. |
How to call it directly
If you're integrating from your own code rather than a chat client, this is the JSON-RPC payload:
curl -X POST https://mcp-analytics.com/mcp \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "compare_periods",
"arguments": {
"site_id": "abc12345",
"metric": "pageviews",
"period_a": "last_7_days",
"period_b": "previous_7_days"
}
}
}'
Token comes from /settings after you sign up. Replace any required arguments above.
Related tools
event_details: Details for one event.get_overview: TL;DR for the period: headline metrics (pageviews, visitors, sessions, bounce rate, avg session duration) plus pageviews_change_pct vs the previous equivalent window, top page, top traffic source, bot share, and top 3 custom events.traffic_class_breakdown: Hit counts and percentages by traffic_class for the period.regenerate_api_token: Invalidate the current API token and issue a new one.list_sites: List all sites on the authenticated account.