How do I email a report every Monday morning automatically?
Recipe verified on
Ran on a private test instance
Short answer
Make the report once (a saved view plus create_report), then ask your AI to schedule it with the cron 0 8 * * 1: every Monday at 08:00 UTC it re-runs the view and emails the result to the people you name. Every run is recorded, so you can check it went out.
Steps
- Connect your assistant to your instance (this writes, so it needs your own instance with a ReadWrite key
from the accounts portal; the public demo is read-only). In Claude Code:
claude mcp add --transport http mcpdata https://[you].mcpdata.org/mcp --header "Authorization: Bearer $CDB_API_KEY"
Replace
[you]with your instance's name. Other apps: Connect your AI. - Ask your question. Give your AI this prompt:
Using mcpdata, email me the weekly revenue report every Monday at 08:00 UTC.
What your AI does: the tool calls it makes for this prompt, and what came back
create_view(name="sales.weekly_revenue", select_sql="SELECT order_week, SUM(revenue) AS revenue FROM Demo.Orders GROUP BY order_week ORDER BY order_week") → created true, view sales.weekly_revenue
create_report(name="Weekly revenue", view="sales.weekly_revenue", format="html") → report_id 4e2a9def1ffc400cbe8f654fbc1f830c
schedule_report(report_id="4e2a9def1ffc400cbe8f654fbc1f830c", cron="0 8 * * 1", recipients=["[email protected]"], enabled=false) → schedule_id e14b4da9ea374b18833a4b49b895bbc1
list_reports() → done
The assistant needs mcpdata connected (step 1) to run the query.
Why this works
The schedule runs on the server, so nothing needs your laptop or a chat to be open. Each run re-queries the view, so the email always has current numbers, and list_report_runs shows every send with its status. (In the test below the schedule is created switched off, so the test emails nobody; yours is on unless you say otherwise.)