How do I get Claude to make a weekly sales report from my data?
Recipe verified on
Ran on a private test instance
Short answer
Ask Claude to save the weekly query as a view (create_view), turn it into a report with a chart (create_report), and run it (run_report). The report re-queries the view every time, so next week's numbers come from next week's data, and schedule_report sends it on a timetable.
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, make a weekly sales report from Demo.Orders for 2025: revenue and orders per week, with a line chart. Run it once so I can see it.
What your AI does: the tool calls it makes for this prompt, and what came back
create_view(name="sales.weekly_2025", select_sql="SELECT order_week, SUM(revenue) AS revenue, COUNT(*) AS orders FROM Demo.Orders WHERE order_year = 2025 GROUP BY order_week ORDER BY order_week") → created true, view sales.weekly_2025
create_report(name="Weekly sales 2025", view="sales.weekly_2025", format="html", chart={"chart": "line", "x": "order_week", "y": "revenue", "title": "Revenue per week"}) → report_id b0315b0950c543f5801fca6f93d21fb6
run_report(report_id="b0315b0950c543f5801fca6f93d21fb6") → status ok, rows 53
The assistant needs mcpdata connected (step 1) to run the query.
Why this works
A report built on a saved view is the same query every week, not a new one written from memory each time, so the numbers are comparable. The chart and the table come from the same rows; email gets the table, the HTML file opens with its interactive chart.