MCP tools for analytics and optimization
Query dashboard totals, traffic, current audience overlaps, segment engagement, and Stripe revenue by segment, or read the optimization playbook through MCP.
Use these MCP tools to read dashboard totals, traffic sources, audience overlaps, segment engagement, and revenue by segment. They can also retrieve the optimization catalog. They do not publish configuration, change a visitor, or run a suggested optimization. Dates, membership definitions, and unavailable-data behavior differ between reports, so their totals aren't interchangeable. Conversion goal results, with or without a campaign, come from get-goal-performance.
MCP analytics access and examples
Project reports accept an optional string project_id. You need an authorized MCP connection and access to the selected project. Invalid IDs, missing project selection, inaccessible projects, and disabled MCP access return errors.
get-optimization-playbook is a catalog read with no project argument. The other operations read collected events, not simulated traffic from an unpublished draft. Name enrichment can use current configuration labels.
Examples are illustrative and were not executed. Requests are parameters for MCP tools/call. Responses show decoded payloads; excerpts are labeled. Dates and numbers are synthetic.
get-analytics-overview
Returns the dashboard's core survey, enrichment, offer, and campaign metrics with time series.
| Argument | Type | Required | Default and behavior |
|---|---|---|---|
project_id | string | No | Active or eligible project. |
date_from | string | Yes | ISO start date/time. |
date_to | string | Yes | ISO end date/time. |
timezone | string | No | UTC; timezone for date bucketing. |
The tool reads the whole range you request. Time series use calendar buckets in timezone: day when the range spans 31 days or less, week up to 366 days, and month beyond. Weeks start on Monday, so the first and last buckets can cover only part of a day, week, or month. The response's interval names the bucket size.
Raw analytics events are kept for 365 days. A range that starts more than a year ago counts only the part that's still kept, and the response doesn't flag it.
Illustrative response excerpt:
The complete response fields are:
| Field | Shape and meaning |
|---|---|
complete | true. A read that can't finish returns an error instead of a response. |
campaignTotals | {status}, plus reason when status is unavailable and maxDays when reason is range_too_long. Says whether exposures and conversions were read. |
interval | Bucket size of every time series: day, week, or month. |
exposures, conversions | Arrays of {holdback, result} summed from campaigns with testing enabled. |
totalAnswers, totalRespondents | Answer and respondent totals. |
answersData, respondentsData | Arrays of {x, y} date buckets. |
oldAnswersData | Compatibility series containing respondent counts as {x, y}. |
totalNewEnrichedPoints, newEnrichedPointsData | Data-point enrichment total and {x, y} series. |
totalNewEnriches, newEnrichesData | Subscriber enrichment total and {x, y} series. |
toBeUsedForNewEnrichesData | Object containing syncUpsData: subscribersEnriched: {value}, dataPointsEnriched: {value}, and timeSeries. |
totalVisitorOffersConverted, offersData | Offer conversion total and nested offer report. |
totalVisitorQuestionsConverted, questionsData | Question conversion total and nested question report. |
Enrichment timeSeries items contain key, subscribersEnriched, and dataPointsEnriched. Offer and question report objects have visitorsExposed, visitorsConverted, and timeSeries entries containing x, visitorsExposed, and visitorsConverted. They add offerBreakdowns or questionBreakdowns, with the same counts/series plus offerId or questionId. Recognized IDs can receive _name companions.
When a search behind the report errors, times out, loses shards, or can't reach the analytics backend, the tool returns an error instead of zeros: Dashboard metrics for this range could not be read completely right now. Try again in a minute, or a shorter range. Zeros in a successful response are real counts for the retained data. Invalid dates also return an error. An end before the start, or an unrecognized timezone, returns the same error as a failed search, so check them before retrying. Use an IANA timezone name such as America/New_York.
Campaign arm totals are read separately and aren't covered by complete. campaignTotals says whether they were read. With status: "ready", exposures and conversions are the totals, and empty arrays mean no campaign has testing enabled. With status: "unavailable", both arrays are empty because the totals are unknown, not zero, and reason says why:
reason | Meaning |
|---|---|
range_too_long | The range covers more than maxDays (90) calendar days in timezone. Request 90 days or less for arm totals. |
invalid_timezone | The analytics search accepted timezone, but campaign reports can't read it. Use an IANA name such as America/New_York. |
capped | The campaign results are too large to compute. Choose fewer days. |
computation_failed | The campaign results couldn't be loaded. Call again in a minute. |
The other metrics still cover the whole range when arm totals are unavailable. This operation has no configuration side effect.
get-audience-breakdown
Builds a date-and-traffic-filtered visitor cohort, then reports those visitors' current segment membership and cross-dimension overlaps.
| Argument | Type | Required | Default and limits |
|---|---|---|---|
project_id | string | No | Active or eligible project. |
date_from, date_to | strings | Yes | ISO date/time range; end must not precede start. A date-only date_to (YYYY-MM-DD) includes that whole day in timezone; a timestamp is used as supplied. |
timezone | string | No | UTC; used to parse dates without an explicit zone. |
filters | object | No | No cohort filters. Nested contract below. |
overlap_dimension_ids | array | No | Zero or exactly two distinct, nonempty dimension-ID strings. |
min_visitors | integer | No | 1; minimum 1; applies to overlap rows. |
limit | integer | No | 20; clamped to 1–100 overlap rows. |
The declared overlap item schema permits strings or numbers, but runtime validation requires strings. Two IDs select their exact cross-tab; omitting them returns top overlaps across dimensions. IDs are validated against published dimensions, with draft fallback only when no published configuration exists.
Cohort filter schema
Values within a filter key are OR alternatives. Different keys combine with AND. Unknown keys are rejected.
| Key | Value and normalization |
|---|---|
visitor_type | String subscriber or anonymous, trimmed and lowercased. |
countries | Nonempty string array of two-letter country codes, uppercased. |
regions, cities | Nonempty string arrays; entries trimmed and nonblank. |
browsers, device_types, operating_systems, languages | Nonempty string arrays; entries trimmed and nonblank. |
referrer_domains | Nonempty hostname array or direct; lowercased, leading www. removed; no URL paths or spaces. |
landing_pages, visited_pages | Nonempty path arrays; every entry must start with / and matches a whole path exactly, with no prefixes or wildcards. |
utm_sources, utm_mediums, utm_campaigns | Nonempty arrays of exact decoded strings, as returned by traffic analytics. Empty strings and whitespace are preserved as values. |
An empty filter object means no filters. Empty arrays for supplied filter keys are invalid. There are no nested and/or objects, segment-ID filters, or free-text expressions.
Illustrative response excerpt:
The envelope contains cohort, dimensions, and overlaps:
cohorthas the fields shown. The time window selects activity;membership: "current"means membership is read now, not reconstructed as it was on each historical date.- Each dimension has
dimensionId,dimensionName,totalVisitors,coveragePct, andsegments. Segment entries havesegmentId,segmentName,visitors,percentOfClassifiedAudience, andpercentOfDimension. - Each overlap has
firstDimensionId,firstDimensionName,firstSegmentId,firstSegmentName, the corresponding foursecond...fields,visitors,percentOfClassifiedAudience,percentOfFirstSegment,percentOfSecondSegment, andliftPct.
Responses are cached for five minutes. Queries are bounded to 500,000 pageviews and 100,000 cohort visitors, with a backend search timeout. A landing_pages filter reads every pageview in the range to find each visitor's first page, so other filters can't shrink what its 500,000-pageview limit counts, and it allows a shorter range than other filters on a busy project. Its error names the pageview count and suggests a shorter range, or visited_pages, which other filters narrow first. Invalid dates, unknown dimensions, invalid filter shapes, excessive cohorts, and incomplete/failed analysis return errors rather than a made-up empty audience. A cohort that can't be read within the request's time budget returns This audience is too large to analyse in one request. Narrow date_from/date_to or add filters. Narrow the date range or filters when a query exceeds these limits. This operation does not change memberships or configuration.
get-traffic-analytics
Returns selected website traffic breakdowns.
| Argument | Type | Required | Default and limits |
|---|---|---|---|
project_id | string | No | Active or eligible project. |
date_from, date_to | strings | Yes | YYYY-MM-DD dates or ISO date/times. A bare date_from starts at the beginning of that day and a bare date_to runs through the end of that day, both in timezone, so one date in both reads that whole day. |
timezone | string | No | UTC. |
limit | integer | No | 20; clamped to 1–200 entries per section. |
sections | array | No | All sections when omitted. |
visitor_type | string | No | subscriber, anonymous, or omit for both. |
The declared section-item schema allows strings or numbers; use the exact recognized names below. An unknown visitor-type string does not apply a visitor-type filter, so do not rely on it being rejected.
Every count is unique visitors, and rows are sorted by that count. visitor_type filters every section, the UTM sections included.
The response is an object containing selected recognized section keys, without an additional data envelope:
| Section | Nested response |
|---|---|
visitorType | {anonymous, subscribers, suspectedBots} |
trafficSources | Array of {channel, count} |
referrers | Array of {domain, count} |
landingPages, mostViewedPages | Arrays of {host, page, count, pageviews}. page is the path, so / on two domains is two rows. count is unique visitors. |
utmCampaigns, utmSources, utmMediums | Arrays of {value, count}; decoded UTM strings. |
skippedSections | Present only when sections were left out: a map from section key to the reason. |
geographic | countries with {code,name,count}, and regions/cities with {name,count}. |
languages | Array of {code,name,count}, grouped by base language code. |
deviceTypes | Array of {type,count} |
operatingSystems, browsers | Arrays of {name,count} |
landingPages counts arrivals: visitors whose pageview came from another site (a referrer outside the project's own hosts) or from a tagged link (utm_*, gclid, or fbclid). A visitor who arrived on two pages counts on both. Direct arrivals with no referrer and no tags aren't counted, because pageviews can't tell them apart from clicks between pages.
There is no 90-day calendar cap. A range over 2,000,000 pageviews is refused. Over 500,000 pageviews, landingPages and the three UTM sections are left out and skippedSections says why, with the shorter range in days to ask for them alone; the other sections still answer. A request for only those sections over 500,000 pageviews is refused. The query times out after the analytics timeout, 8 seconds by default, with a message to try a shorter range. Web Analytics is temporarily unavailable means the analytics backend couldn't be reached.
The report uses a five-minute cache. Reduce the range or select fewer sections when a request is refused or times out. This operation does not change configuration or visitor data.
get-segment-engagement
Compares each segment with the other classified visitors in the same dimension, using page engagement or conversion rate.
| Argument | Type | Required | Default and behavior |
|---|---|---|---|
project_id | string | No | Active or eligible project. |
date_from, date_to | strings | Yes | Inclusive local dates, YYYY-MM-DD or ISO date/time. |
timezone | string | No | UTC; dates expand to local day boundaries. |
basis | string | No | engagement, conversion, or offer_conversion; default engagement. |
goal_id | string | For conversion | Goal ID. |
offer_id | string | For offer_conversion | Offer ID. |
dimension_ids | array | No | All published dimensions; declared items allow strings/numbers, but use dimension-ID strings. |
min_visitors | integer | No | 30; see threshold limitation below. |
Illustrative response excerpt:
The envelope has basis, nullable goalId/offerId, dateRange, dimensions, and leaderboard. Dimensions have dimensionId, dimensionName, baseline, baselineVisitors, and segment entries. Segments have segmentId, segmentName, uniqueVisitors, value, baseline, liftPct, confidence, and statusReason. Conversion entries add converters.
engagement values are pages per visitor. Conversion values are proportions, such as 0.12 for 12%, not the percentage-unit values returned by split-test metrics. Segment baselines exclude that segment and use the other classified visitors in its dimension. Dimension-level baseline summarizes the dimension as a whole.
A nonpositive baseline makes liftPct null and confidence insufficient. statusReason distinguishes no_baseline_visitors, no_baseline_engagement, and no_baseline_conversions. Never turn null lift into a claimed 100% improvement. Confidence labels are sample-size bands applied to the smaller side of each comparison, the segment or the rest of the classified visitors it's compared with: fewer than 30 is insufficient, 30–99 low, 100–499 medium, and 500+ high. Conversion rates are also insufficient when either side has fewer than 10 converters. They are not a significance test.
Engagement windows whose expanded start/end differ by more than 30 days are capped internally and add dateRangeCapped: true and maxEngagementDays: 30. The query starts at local midnight 30 calendar days before the end date, so the capped query can cover 31 inclusive calendar dates. The returned dateRange still describes the requested boundaries, not that adjusted start. Large segment membership can use up to 1,000 visitor IDs per segment; affected segment entries add isSampled: true and sampleSize. Use these fields when describing precision.
This MCP tool disables overlap leaderboards, returning empty best/worst arrays. The service applies min_visitors to leaderboard combinations, not the main segment rows, so do not assume this argument excludes low-count segments in this tool's response. Apply your own reporting threshold to uniqueVisitors if needed.
Missing basis-specific IDs return explicit errors. Unknown basis strings fall through to engagement calculation rather than reliable enum validation; send only the documented values.
With basis conversion, the response adds a goalTracking object with status, from, explanation, and detail, the same tracking object get-goal-performance returns. Every published goal is recorded site-wide, whether or not a campaign lists it. status is recorded when the goal is measured; a non-null from means conversions count only from that time, when the project's published site started recording goals. after_next_publish means the live site doesn't record the goal yet, with the explanation "Conversions start recording after your next publish." Its detail says why: the goal isn't published yet, it has no conversion events, or the project hasn't published since site-wide goal recording launched on November 3, 2026. paused means the goal is paused. Both return no metrics, so publish the goal, or resume it, before reading conversion engagement. Past conversions are never backfilled.
Reporting exceptions can also produce an empty response, so an empty result is not proof of zero engagement. Nonempty results are cached for five minutes. No configuration or visitor state is changed.
get-segment-revenue
Reads net payments imported from Stripe and splits them by segment group. It is listed only while Stripe is connected to the project; connect it in the app (Connect Stripe and see which segments buy) or with connect-integration. How revenue by segment is counted explains the rules, which match the dashboard and segment group pages.
| Argument | Type | Required | Default and behavior |
|---|---|---|---|
project_id | string | No | Active or eligible project. |
date_from | string | No | Inclusive local date, YYYY-MM-DD; default 29 days before date_to. |
date_to | string | No | Inclusive local date, YYYY-MM-DD; default today. At most 366 inclusive days. |
timezone | string | No | UTC; IANA timezone for the dates. |
segment_group_ids | array of strings | No | Segment group IDs or question IDs; a question resolves to its segment group. Default every group. Unknown IDs return an error. |
currency | string | No | Three-letter ISO code, such as USD, to report only that currency. |
Illustrative response excerpt:
status is one of:
| Status | Meaning |
|---|---|
ready | Revenue is in the response. |
computing | Call again with the same arguments after retry_after_seconds. |
importing | The last 90 days of payments are still importing; try again later. |
blocked | The payment source needs to be reconnected; message carries the source's reason. |
not_connected | No payment source is connected. |
unavailable | Revenue couldn't be loaded; message explains why. |
Every status except computing includes period. Every status except computing and not_connected includes sources, each with app, name, status, livemode, last_synced_at, imported_from, and message.
A ready response also has matching (complete, capped, or failed), customers (known, or importing until Stripe's full history is in), tracking_from, people (ready or unavailable), min_buyers, platform, currencies, and notes. platform is null when matching isn't complete, when the project has no native email platform connection, or when no question group syncs its answers to that platform; otherwise it's {provider, buyers, checked}, the platform's name and how many of the buyers it has looked up so far. Each currencies entry has currency, net, refunded, payments, buyers, without_email (payments with no buyer email, which can't be matched), new_customers (first payment ever in the range), existing_customers, matched, platform_matched (buyers matched to a contact in the email platform rather than a visitor), unplaced (buyers state groups couldn't place, by reason), and segment_groups. Amounts are {net, buyers} objects. While customers is importing, new_customers, existing_customers, and unplaced are null.
Each segment group has id, name, question_ids, basis, multi_winning, and split. basis is current_answer for groups a question fills (every buyer credited to the answer they hold now: the one recorded on the site, or else the one their email platform contact holds) or state for other groups (new customers credited where they stood when they bought, existing customers where they stood on their latest recognized visit; these never use the email platform). split is ready, history_importing, capped (too many buyers to match; use a shorter range), or failed (try again later). Only ready groups add credited, outside (buyers in none of the group's segments), credited_new, from_platform (the credited buyers whose answer came from the email platform), and segments in group order. For a current_answer group, credited plus outside equals matched plus platform_matched.
Each segment has id, name, net, buyers, people, share_of_revenue, share_of_people, revenue_per_buyer, guarded, and worth. Shares are percentages. A guarded segment has fewer than min_buyers (5) buyers, or sits in a group with fewer than 5 credited buyers, so its share_of_revenue and revenue_per_buyer are null.
worth follows the people seen in the segment during a fixed window (window_from to window_to, the 30 days that ended 31 days ago, independent of the requested dates) for 30 days, customers included. It has people, paid, rate, net, and worth (paid per person in this currency). rate and worth stay null below 5 paid or 30 people. The whole worth object is null while it computes or when it can't be loaded; a note says which.
Follow these rules when reporting the numbers:
- Currencies are never added together. Report each currency separately.
- Relay the
notesarray. It explains guarded segments, unplaced buyers, payments without email, multi-winning groups whose shares can add up to more than 100%, history still importing, and email platform lookups still filling in (as in "120 of 472 buyers have been looked up in Kit so far, so answers from Kit are still filling in."). - Revenue by segment is an observation, not a controlled test. It doesn't show that a segment caused the payments.
Invalid timezones, dates, ranges over 366 days, currency codes, and unknown segment group IDs return errors. This operation is read-only.
get-optimization-playbook
Lists active best-practice definitions that the recommendation system can detect. It does not run an account audit or return findings specific to your project.
The optional category string is normally fix, opportunity, or next_level. There is no project_id argument. Omit the category for all active practices. An unmatched value returns no practices rather than an enum error.
Illustrative response with no matching active practices:
Each practices item has practice_id, category, what_it_detects, effort, and tier_requirement. Results are ordered by category and practice ID. The categories descriptions remain present even for a filtered or empty result. Availability and text come from the current active catalog; this reference does not promise a fixed practice count.
This read has no project-selection step, provider request, draft mutation, or live-site effect. A recommendation definition is not evidence that the condition exists in your project.