What You Will Learn
- The minimum script pattern for direct usage
- The minimum MCP prompt pattern in AI clients
- Clear division of responsibilities between cwprep and cwtwb
Prerequisites
- MCP setup and connectivity check completed
- A demo-ready data source (table or CSV)
Case A: cwprep (Data Flow)
cwprep generates Tableau Prep flows (.tfl/.tflx).
Script Pattern
flow = {
"flow_name": "orders_filter_demo",
"connection": {"type": "database", "host": "localhost", "db_class": "mysql", "username": "root", "dbname": "demo"},
"nodes": [
{"type": "input_table", "name": "orders", "table": "orders"},
{"type": "filter", "name": "sales_filter", "parent": "orders", "expression": "[sales] > 100"},
]
}MCP Prompt Pattern
Use cwprep:
1) input table orders
2) filter sales > 100
3) output tfl to local output/demo.tflCase B: cwtwb (Workbook)
cwtwb generates Tableau workbooks (.twb/.twbx).
Script Pattern
Core actions are usually:
- Create workbook
- Connect data source
- Create worksheet
- Configure chart
- Save as
.twb/.twbx
MCP Prompt Pattern
Use cwtwb:
1) load superstore data
2) create a Sales by Category bar chart worksheet
3) save to output/sales_by_category.twbHow They Work Together
- Use
cwprepfirst to clean and shape data - Use
cwtwbsecond to build dashboards on top of that data
Validation Checklist
- One
.tfl/.tflxgenerated successfully - One
.twb/.twbxgenerated successfully - You can explain why
cwprep -> cwtwbis the default order
First-Practice Tips
- Start from minimal cases, not full dashboards
- Keep prompts and outputs for reproducibility
- If it fails, isolate first: script command first, MCP config second