Skip to help content
RightMessage
MCP referenceReference

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.

Available on the Grow, Scale, and Pro plans.

Updated

View as Markdown

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.

ArgumentTypeRequiredDefault and behavior
project_idstringNoActive or eligible project.
date_fromstringYesISO start date/time.
date_tostringYesISO end date/time.
timezonestringNoUTC; 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.

JSON
{"name":"get-analytics-overview","arguments":{"project_id":"123456789","date_from":"2026-10-01T00:00:00Z","date_to":"2026-10-13T00:00:00Z","timezone":"UTC"}}

Illustrative response excerpt:

JSON
{"complete":true,"campaignTotals":{"status":"ready"},"interval":"day","totalAnswers":48,"totalRespondents":30,"answersData":[{"x":"2026-10-12T00:00:00Z","y":48}],"respondentsData":[{"x":"2026-10-12T00:00:00Z","y":30}],"exposures":[{"holdback":false,"result":100},{"holdback":true,"result":100}],"conversions":[{"holdback":false,"result":15},{"holdback":true,"result":12}]}

The complete response fields are:

FieldShape and meaning
completetrue. 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.
intervalBucket size of every time series: day, week, or month.
exposures, conversionsArrays of {holdback, result} summed from campaigns with testing enabled.
totalAnswers, totalRespondentsAnswer and respondent totals.
answersData, respondentsDataArrays of {x, y} date buckets.
oldAnswersDataCompatibility series containing respondent counts as {x, y}.
totalNewEnrichedPoints, newEnrichedPointsDataData-point enrichment total and {x, y} series.
totalNewEnriches, newEnrichesDataSubscriber enrichment total and {x, y} series.
toBeUsedForNewEnrichesDataObject containing syncUpsData: subscribersEnriched: {value}, dataPointsEnriched: {value}, and timeSeries.
totalVisitorOffersConverted, offersDataOffer conversion total and nested offer report.
totalVisitorQuestionsConverted, questionsDataQuestion 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:

reasonMeaning
range_too_longThe range covers more than maxDays (90) calendar days in timezone. Request 90 days or less for arm totals.
invalid_timezoneThe analytics search accepted timezone, but campaign reports can't read it. Use an IANA name such as America/New_York.
cappedThe campaign results are too large to compute. Choose fewer days.
computation_failedThe 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.

ArgumentTypeRequiredDefault and limits
project_idstringNoActive or eligible project.
date_from, date_tostringsYesISO 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.
timezonestringNoUTC; used to parse dates without an explicit zone.
filtersobjectNoNo cohort filters. Nested contract below.
overlap_dimension_idsarrayNoZero or exactly two distinct, nonempty dimension-ID strings.
min_visitorsintegerNo1; minimum 1; applies to overlap rows.
limitintegerNo20; 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.

KeyValue and normalization
visitor_typeString subscriber or anonymous, trimmed and lowercased.
countriesNonempty string array of two-letter country codes, uppercased.
regions, citiesNonempty string arrays; entries trimmed and nonblank.
browsers, device_types, operating_systems, languagesNonempty string arrays; entries trimmed and nonblank.
referrer_domainsNonempty hostname array or direct; lowercased, leading www. removed; no URL paths or spaces.
landing_pages, visited_pagesNonempty path arrays; every entry must start with / and matches a whole path exactly, with no prefixes or wildcards.
utm_sources, utm_mediums, utm_campaignsNonempty 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.

JSON
{"name":"get-audience-breakdown","arguments":{"project_id":"123456789","date_from":"2026-10-01T00:00:00Z","date_to":"2026-10-13T00:00:00Z","filters":{"countries":["US"],"visited_pages":["/pricing"]},"overlap_dimension_ids":["dim_business","dim_need"],"min_visitors":5,"limit":20}}

Illustrative response excerpt:

JSON
{"cohort":{"matchedVisitors":100,"classifiedVisitors":80,"unclassifiedVisitors":20,"dateFrom":"2026-10-01T00:00:00+00:00","dateTo":"2026-10-13T00:00:00+00:00","membership":"current","filters":{"countries":["US"],"visited_pages":["/pricing"]}},"dimensions":[],"overlaps":[]}

The envelope contains cohort, dimensions, and overlaps:

  • cohort has 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, and segments. Segment entries have segmentId, segmentName, visitors, percentOfClassifiedAudience, and percentOfDimension.
  • Each overlap has firstDimensionId, firstDimensionName, firstSegmentId, firstSegmentName, the corresponding four second... fields, visitors, percentOfClassifiedAudience, percentOfFirstSegment, percentOfSecondSegment, and liftPct.

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.

ArgumentTypeRequiredDefault and limits
project_idstringNoActive or eligible project.
date_from, date_tostringsYesYYYY-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.
timezonestringNoUTC.
limitintegerNo20; clamped to 1–200 entries per section.
sectionsarrayNoAll sections when omitted.
visitor_typestringNosubscriber, 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.

JSON
{"name":"get-traffic-analytics","arguments":{"project_id":"123456789","date_from":"2026-10-01T00:00:00Z","date_to":"2026-10-13T00:00:00Z","sections":["visitorType","referrers"],"limit":10}}
JSON
{"visitorType":{"anonymous":80,"subscribers":20,"suspectedBots":3},"referrers":[{"domain":"example.com","count":60}]}

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:

SectionNested response
visitorType{anonymous, subscribers, suspectedBots}
trafficSourcesArray of {channel, count}
referrersArray of {domain, count}
landingPages, mostViewedPagesArrays of {host, page, count, pageviews}. page is the path, so / on two domains is two rows. count is unique visitors.
utmCampaigns, utmSources, utmMediumsArrays of {value, count}; decoded UTM strings.
skippedSectionsPresent only when sections were left out: a map from section key to the reason.
geographiccountries with {code,name,count}, and regions/cities with {name,count}.
languagesArray of {code,name,count}, grouped by base language code.
deviceTypesArray of {type,count}
operatingSystems, browsersArrays 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.

ArgumentTypeRequiredDefault and behavior
project_idstringNoActive or eligible project.
date_from, date_tostringsYesInclusive local dates, YYYY-MM-DD or ISO date/time.
timezonestringNoUTC; dates expand to local day boundaries.
basisstringNoengagement, conversion, or offer_conversion; default engagement.
goal_idstringFor conversionGoal ID.
offer_idstringFor offer_conversionOffer ID.
dimension_idsarrayNoAll published dimensions; declared items allow strings/numbers, but use dimension-ID strings.
min_visitorsintegerNo30; see threshold limitation below.
JSON
{"name":"get-segment-engagement","arguments":{"project_id":"123456789","date_from":"2026-10-01","date_to":"2026-10-12","basis":"engagement","dimension_ids":["dim_business"],"timezone":"UTC"}}

Illustrative response excerpt:

JSON
{"basis":"engagement","goalId":null,"offerId":null,"dateRange":{"start":"2026-10-01T00:00:00Z","end":"2026-10-12T23:59:59Z","timezone":"UTC"},"dimensions":[{"dimensionId":"dim_business","dimensionName":"Business type","baseline":2.4,"baselineVisitors":100,"segments":[{"segmentId":"seg_agency","segmentName":"Agency","uniqueVisitors":40,"value":3,"baseline":2,"liftPct":50,"confidence":"low","statusReason":null}]}],"leaderboard":{"best":[],"worst":[]}}

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.

ArgumentTypeRequiredDefault and behavior
project_idstringNoActive or eligible project.
date_fromstringNoInclusive local date, YYYY-MM-DD; default 29 days before date_to.
date_tostringNoInclusive local date, YYYY-MM-DD; default today. At most 366 inclusive days.
timezonestringNoUTC; IANA timezone for the dates.
segment_group_idsarray of stringsNoSegment group IDs or question IDs; a question resolves to its segment group. Default every group. Unknown IDs return an error.
currencystringNoThree-letter ISO code, such as USD, to report only that currency.
JSON
{"name":"get-segment-revenue","arguments":{"project_id":"123456789","date_from":"2026-09-28","date_to":"2026-10-27","timezone":"America/New_York","segment_group_ids":["dim_lifecycle"],"currency":"USD"}}

Illustrative response excerpt:

JSON
{"status":"ready","period":{"start":"2026-09-28","end":"2026-10-27","timezone":"America/New_York"},"sources":[{"app":"stripe","name":"Stripe","status":"ready","livemode":true,"last_synced_at":"2026-10-27T14:05:00+00:00","imported_from":"2025-03-02T00:00:00+00:00","message":null}],"matching":"complete","customers":"known","tracking_from":"2025-06-01","people":"ready","min_buyers":5,"platform":{"provider":"Kit","buyers":472,"checked":472},"currencies":[{"currency":"USD","net":48200.5,"refunded":310,"payments":512,"buyers":472,"without_email":{"net":120,"payments":2},"new_customers":{"net":2900,"buyers":48},"existing_customers":{"net":45300.5,"buyers":424},"matched":{"net":41100,"buyers":350},"platform_matched":{"net":5200,"buyers":64},"unplaced":{"before_tracking":{"net":800,"buyers":6},"not_matched":{"net":6980.5,"buyers":120},"not_seen":{"net":0,"buyers":0},"pending":{"net":99,"buyers":1},"not_seen_since_buying":{"net":400,"buyers":4}},"segment_groups":[{"id":"dim_lifecycle","name":"Customer Lifecycle","question_ids":[],"basis":"state","multi_winning":false,"split":"ready","credited":{"net":39801,"buyers":339},"outside":{"net":1200,"buyers":9},"credited_new":{"net":2600,"buyers":41},"from_platform":{"net":0,"buyers":0},"segments":[{"id":"seg_customer","name":"Customer","net":36000,"buyers":300,"people":900,"share_of_revenue":90.4,"share_of_people":12.5,"revenue_per_buyer":120,"guarded":false,"worth":{"window_from":"2026-08-28","window_to":"2026-09-26","people":400,"paid":12,"rate":3,"net":1440,"worth":3.6}}]}]}],"notes":["Segment groups filled by a question (basis current_answer) credit every buyer to the answer they hold now…"]}

status is one of:

StatusMeaning
readyRevenue is in the response.
computingCall again with the same arguments after retry_after_seconds.
importingThe last 90 days of payments are still importing; try again later.
blockedThe payment source needs to be reconnected; message carries the source's reason.
not_connectedNo payment source is connected.
unavailableRevenue 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 notes array. 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.

JSON
{"name":"get-optimization-playbook","arguments":{"category":"fix"}}

Illustrative response with no matching active practices:

JSON
{"total":0,"categories":{"fix":"Something is broken or severely underperforming","opportunity":"Leaving value on the table — could be significantly better","next_level":"Advanced usage or unexplored features"},"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.

Still need a hand?

Tell us what you’re trying to do and where you’re getting stuck.

support@rightmessage.com