DEV Community

suddhasheel bhatt
suddhasheel bhatt

Posted on

I Built a Tableau Dashboard with an AI Agent. Here’s Every Step That Actually Happened.

No hype. No “AI generates dashboards” vaporware. Just a real build, real commands, and a .twb file that opened in Tableau Desktop.

I’ve seen a lot of “AI + Tableau” content lately. Most of it follows the same script: dramatic demo, hand-wavy explanation, no reproducible steps. So when I came across Twilize — a Tableau MCP server you install with pip — I decided to document exactly what happened when I used it. Every tool call. Every response. Every quirk.

This is that post.

What Is Twilize, Exactly?
— — — — — — — — — — — — —

Twilize is a Python package that runs as a local MCP (Model Context Protocol) server. MCP is an open protocol, originally from Anthropic, that lets AI assistants like Claude connect to external tools through a standardised interface — the same way a USB port lets any device plug into any computer.

What Twilize adds to this is a Tableau-specific toolset: a set of MCP functions that can create workbooks, add worksheets, configure chart types, build dashboard layouts, and save validated .twb files — all from natural language instructions or direct tool calls.

It is not a chatbot that “analyses” your Tableau dashboards. It is a workbook engineering layer. The distinction matters: Twilize writes Tableau files, it doesn’t read them for insights.

Install it with:

pip install twilize

Or with bundled examples:

pip install “twilize[examples]”

More at: https://twilize.com/tableau-mcp-server/

— -

Step 1: Check What It Can Actually Do
— — — — — — — — — — — — — — — — — — — -

Before building anything, I called list_capabilities to understand Twilize’s boundary. The response was honest and precise — something I didn’t expect.

It returned three tiers:

CORE (18 capabilities): Bar, Line, Area, Pie, Map, Text charts; Hyper, Excel, MySQL, federated connections; Color, Size, Tooltip encodings; dashboard layout containers.

ADVANCED (19 capabilities): Scatterplot, Heatmap, Bubble, Dual Axis, Tree Map; Filter and Highlight actions; LOD expressions; Reference Lines; Trend Lines; Color Palettes; Dashboard Themes.

RECIPE (6 capabilities): Donut, Lollipop, Bullet, Bump, Butterfly, Calendar charts — these are composite chart types built from Tableau primitives.

UNSUPPORTED (3): Bins, Sets, Table Calculations — explicitly flagged as out of scope.

That last category is rare in AI tooling. Most systems quietly fail or hallucinate when you ask for something they can’t do. Twilize tells you upfront. That’s good engineering.

— -

Step 2: Create the Workbook
— — — — — — — — — — — — — — -

I called create_workbook with a workbook name. In under a second, it returned the full field schema — every dimension and measure available:

Dimensions: Category, City, Country/Region, Customer ID, Customer Name, Order ID, Product Name, Region, Segment, Ship Mode, State/Province, Sub-Category…

Measures: Sales, Profit, Discount, Quantity, Order Date, Ship Date…

This is the Superstore dataset — Tableau’s built-in sample data — and Twilize wired it up automatically. No connection string. No credentials. No manual field mapping. You get a ready-to-use schema in one call.

— -

Step 3: Build the First Worksheet — Revenue by Region
— — — — — — — — — — — — — — — — — — — — — — — — — — —

I added a worksheet called “Revenue by Region” and configured it as a horizontal bar chart:

  • Mark type: Bar
  • Rows: Region
  • Columns: SUM(Sales)
  • Color: Region (one colour per bar)
  • Sort: descending by SUM(Sales)

Here’s what I didn’t expect: on my first attempt, I passed sort_descending as a boolean (true). Twilize rejected it with a clear validation error — it expected the field name to sort by, not a boolean flag. I corrected it to sort_descending=”SUM(Sales)” and it worked.

More usefully, after I accidentally omitted the sort on an earlier attempt, Twilize responded with a RULE VIOLATION warning:

[WARNING] bar.unsorted: Bar charts must be sorted descending by the measure.
-> Add sort_descending=’SUM(Sales)’

It caught a best practice violation and told me exactly how to fix it. This is what sets Twilize apart from a simple code generator — it has Tableau-specific design rules baked in.

— -

Step 4: Add the Monthly Trend Line
— — — — — — — — — — — — — — — — — — -

Next worksheet: a line chart showing monthly sales trends, broken down by customer Segment (Consumer, Corporate, Home Office).

  • Mark type: Line
  • Columns: MONTH(Order Date)
  • Rows: SUM(Sales)
  • Color: Segment

One call. Tableau date functions (MONTH()) work natively — no special syntax, no workarounds.

— -

Step 5: Add the KPI Tile
— — — — — — — — — — — — —

Download the Medium app
Third worksheet: a text/BAN (Big Ass Number) tile showing total revenue.

  • Mark type: Text
  • Label: SUM(Sales)

This is the kind of element that’s tedious to build in Tableau manually (text table, format number, remove headers, resize…). Here it’s a single configure_chart call.

— -

Step 6: Assemble the Dashboard
— — — — — — — — — — — — — — — —

With three worksheets ready, I called add_dashboard:

  • Dashboard name: “Sales Performance Dashboard”
  • Worksheets: Total Revenue KPI → Revenue by Region → Monthly Sales Trend
  • Layout: vertical
  • Size: 1200 x 800

The result: a combined dashboard with all three views arranged in order. One call, no drag and drop, no layout wrestling.

— -

Step 7: Validate
— — — — — — — — —

Before saving, I ran validate_workbook. It found 2 minor XSD schema deviations — both informational, flagged as non-blocking. The response was clear:

“These are informational only — Tableau Desktop is the true validator and will almost certainly open this workbook without issues.”

No false confidence. It told me what it found, what it means, and what to expect. The workbook opened cleanly.

— -

Step 8: Save to Desktop
— — — — — — — — — — — — —

Final call: save_workbook with an output path.

C:\Users[username]\Desktop\Sales_Performance_Dashboard.twb

Done. A real Tableau workbook on the desktop, ready to open, with three charts and a dashboard — built entirely through MCP tool calls, without touching Tableau’s interface once.

Total time from create_workbook to saved file: under 3 minutes.

— -

What This Changes for Tableau Developers
— — — — — — — — — — — — — — — — — — — — —

If you build Tableau dashboards professionally, here’s what Twilize actually changes:

Reproducibility. Every workbook is built from a sequence of function calls. That means you can version control it, run it in CI, template it, and rebuild it identically any time. Drag-and-drop dashboards are not reproducible. Twilize workbooks are.

Best practice enforcement. The rule violation system catches common Tableau mistakes — unsorted bars, missing chart elements — before the file is saved. It’s like a linter for Tableau.

Schema migration. This is the killer use case. When your database schema changes and field names break across 30 worksheets, Twilize’s workbook migration tool (https://twilize.com/workbook-migration/) remaps everything automatically using fuzzy field matching. A half-day manual task becomes a 2-minute automated one.

Workbook generation at scale. If you maintain a library of dashboards built on the same data model, Twilize can generate and update them programmatically. No more copy-paste-modify cycles across similar dashboards.

— -

Connecting Twilize to Claude Desktop
— — — — — — — — — — — — — — — — — — —

To use Twilize as an MCP server with Claude, add this to your Claude Desktop config file:

On macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
On Windows: %APPDATA%\Claude\claude_desktop_config.json

{
“mcpServers”: {
“twilize”: {
“command”: “python”,
“args”: [“-m”, “twilize.mcp_server”]
}
}
}

Restart Claude Desktop. Then just describe the dashboard you want in plain English and Claude handles the rest through Twilize’s MCP tools.

The TREX extension file (for embedding Twilize directly in Tableau dashboards) is available at: https://twilize.com/tableau-trex-extension/

— -

The Bigger Picture: Tableau AI Agents in 2026
— — — — — — — — — — — — — — — — — — — — — — — -

Tableau launched on the premise that non-technical users shouldn’t need SQL to explore data. Drag and drop was the simplification.

In 2026, that simplification is happening again — but this time for dashboard building itself. Salesforce’s own Tableau Agent (their Einstein-powered AI layer) is evidence that even the platform vendor sees natural language as the future interface.

What Twilize offers that Tableau Agent doesn’t: file-level control, local operation, MCP compatibility with any AI tool, and a programmable API that works in scripts, pipelines, and CI workflows — not just inside the Tableau Cloud UI.

The tableau AI agent category is real, it’s here, and the .twb file sitting on my desktop right now is proof.

— -

Get Started
— — — — — —

— -

Have questions about setting up Twilize with Claude or Cursor? Drop them in the comments — happy to walk through specific use cases.

Top comments (0)