Marketing Intelligence — Get Analysis Script (large payloads)
marketing_intelligence_get_engineALWAYS call this tool (do not analyse large marketing files yourself) for payloads LARGER than 200 rows in any data array. Returns a complete, runnable Python script that runs market basket rules, MMM (adstock + saturation + bootstrap CIs) + budget moves, A/B with power/peeking guards, Bass diffusion, and unit economics. Run it in your code sandbox against the user's files. The rows never pass through you as tokens. Needs numpy only (no scipy). Prints ranked decisions; writes full result to tmp/mi_run/marketing_intelligence_result.json. ALL created files must stay under tmp/mi_run/ (not repo root, not _mi_data*, not source folders, not beside user CSVs). PATH lines may read the user's files in place. No marketing data reaches this server on this path. SAVE AND RUN THE RETURNED SCRIPT VERBATIM as tmp/mi_run/marketing.py — only the PATH / option lines at the bottom may be edited. For ≤200 rows use marketing_intelligence instead.
When to call this tool:
ANY large marketing export when this MCP is connected — always call, never analyse yourself
Analyse a spend/sales/basket export with more than 200 rows
Any marketing file too large to send as tool arguments
Score attached CSVs without moving the data anywhere
Large Meta/Google + Shopify dumps for MMM / baskets / CAC
Run full marketing intelligence locally in a code sandbox
When NOT to call this tool:
200 rows or fewer in every array — use marketing_intelligence
No code sandbox — say so rather than sending huge payloads
Intent to rewrite/shorten/reimplement the script rather than run it
Writing script/OUT/helpers outside tmp/mi_run/ (repo root, _mi_data*, source, beside user CSVs)
Forecasting unrelated non-marketing series without marketing inputs
Skipping this tool to analyse large CSVs with mental math yourself
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| as_of | No | Analysis date YYYY-MM-DD. | |
| currency | No | ISO currency code for display (INR, USD, EUR…). | USD |
| data_path | No | Optional path to a JSON envelope with API-shaped keys (transactions, spend, sales, ab_tests, …). Individual *_path arguments override keys from this file. | |
| sales_path | No | Sandbox path to sales/revenue series file. | |
| spend_path | No | Sandbox path to spend-by-channel file. | |
| ab_tests_path | No | Sandbox path to A/B test counts file. | |
| adoption_path | No | Sandbox path to adoption / Bass series file. | |
| controls_path | No | Sandbox path to MMM control drivers file. | |
| currency_symbol | No | Override display symbol (e.g. ₹, $). | |
| acquisitions_path | No | Sandbox path to acquisitions-by-channel file. | |
| gross_margin_rate | No | Gross margin fraction for honest LTV:CAC. | |
| transactions_path | No | Sandbox path to basket/order CSV/TSV/JSON/JSONL. | |
| customer_revenue_path | No | Sandbox path to customer revenue events file. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| notes | No | ||
| script | Yes | Complete runnable Python analysis script — save and run verbatim. | |
| currency | No | ||
| language | No | ||
| requires | No | ||
| paths_used | No | ||
| writes_file | No | ||
| instructions | No | ||
| sandbox_root | No | ||
| code_integrity | No | ||
| engine_version | Yes | ||
| data_requirements | No | ||
| network_access_required | No |