Skip to main content

CLI for Tableau Server/Cloud, designed for AI agent integration

Project description

tableau-cli

A command-line interface for Tableau Server / Tableau Cloud, designed for AI agent integration. All output is structured JSON to stdout, with agent-friendly error messages that include actionable hints.

Why CLI over MCP?

MCP (Model Context Protocol) servers continuously occupy agent context — every tool description is loaded into the system prompt, even when only one command is needed. A CLI follows a simpler call-execute-exit pattern: the agent invokes a command, reads the JSON output, and moves on.

The companion Claude Code skill under skills/ extends the same idea to command knowledge — the full reference is loaded only when the agent is about to execute a command, not kept in context upfront. See Use with Claude Code below.

This project provides the same capabilities as the tableau-mcp server, with behavioral alignment in data transformations, error handling, and output structures.

Quick Start

Prerequisites

Install

git clone https://github.com/i-richardwang/tableau-cli.git
cd tableau-cli
pip install -e .

# Optional: install conversion dependencies (TDSX/HYPER → Parquet/CSV)
pip install -e ".[convert]"

Configure

# Option 1: CLI config (saved to ~/.tableau-cli.json)
tableau-cli config set \
  --server https://your-tableau-server.com \
  --site-name YourSite \
  --pat-name your-token-name \
  --pat-value your-token-value

# Option 2: Environment variables
export SERVER=https://your-tableau-server.com
export SITE_NAME=YourSite
export PAT_NAME=your-token-name
export PAT_VALUE=your-token-value

Environment variables take precedence over the config file. siteName defaults to "" (the default site) if not set.

# Verify configuration
tableau-cli config show

Use with Claude Code

This repository ships with a Claude Code skill under skills/. Once loaded, it gives an agent enough context to route a user's request to the right command — without putting the full CLI reference into the system prompt.

skills/
├── SKILL.md              # Intent routing + environment check
└── references/
    ├── cli.md            # Full command reference (loaded before executing)
    └── installation.md   # Install + auth setup (loaded if not configured)

Once Claude Code has loaded the skill, a typical interaction looks like:

  1. The agent runs tableau-cli --help to verify the CLI is installed and configured. If not, it loads references/installation.md and stops until setup is complete.
  2. The agent maps the user's intent to a subcommand using the Intent Routing table in SKILL.md (e.g., "find datasources with Sales in the name" → ds list --filter "name:has:Sales").
  3. Before constructing the actual command, the agent loads references/cli.md — the skill explicitly forbids guessing flags from memory, so the reference is the source of truth for syntax.
  4. The agent runs the command and parses the structured JSON output, including the hint field on errors.

Common workflows (e.g., ds download --to parquet → load with Polars/Pandas) are pre-defined under Intent Routing in SKILL.md, so the agent doesn't have to reason about chaining from scratch.

You can of course use tableau-cli directly from a shell without the skill — the skill is only needed when you want an agent to drive the tool.

Commands

Search

Search across all content types (workbooks, views, datasources, etc.).

tableau-cli search "Superstore"
tableau-cli search "Sales" --type workbook,view
tableau-cli search "Revenue" --limit 10 --order-by hitsTotal:desc

Datasources

# List all datasources
tableau-cli datasources list
tableau-cli ds list --filter "name:has:Sales" --limit 50

# Download datasource file (.tdsx)
tableau-cli datasources download <datasourceId> -o ./data/

# Download and convert to Parquet or CSV in one step (requires tableau-cli[convert])
tableau-cli ds download <datasourceId> -o ./data/ --to parquet
tableau-cli ds download <datasourceId> -o ./data/ --to csv

# Get field metadata (VizQL Data Service + Metadata API enrichment)
tableau-cli datasources metadata <luid>

# Query datasource data (VizQL Data Service)
tableau-cli datasources query <luid> --query '{"fields": [{"fieldCaption": "Category"}, {"fieldCaption": "Sales"}]}'
tableau-cli ds query <luid> --query '{"fields": [...]}' --limit 100

Views

# List views
tableau-cli views list
tableau-cli views list --filter "name:has:Dashboard" --format table

# Get view data as CSV
tableau-cli views data <viewId>

# Download view image
tableau-cli views image <viewId> -o dashboard.png
tableau-cli views image <viewId> --width 1200 --height 800 --img-format SVG -o dashboard.svg

Convert

Convert local TDSX/HYPER files to Parquet or CSV. Requires pip install tableau-cli[convert].

For most use cases, ds download --to parquet (or --to csv) is simpler — it downloads and converts in one step. The convert command is useful when you already have a .tdsx or .hyper file on disk.

# Convert TDSX to Parquet (default)
tableau-cli convert data.tdsx
tableau-cli convert data.tdsx -o ./output/

# Convert to CSV
tableau-cli convert data.tdsx --to csv
tableau-cli convert data.tdsx --to csv -o ./output/

# Convert standalone HYPER file
tableau-cli convert extract.hyper --to csv -o ./output/result.csv

Workbooks

# List workbooks
tableau-cli workbooks list
tableau-cli wb list --filter "name:eq:Finance" --format table

# Get workbook details (includes views with usage statistics)
tableau-cli workbooks get <workbookId>

Config

tableau-cli config set --server https://tableau.example.com
tableau-cli config show

Output

All commands output structured JSON to stdout by default. Use --format table for human-readable table output.

# JSON (default, for agent consumption)
tableau-cli ds list

# Table (for human reading)
tableau-cli ds list --format table

File Output

Commands that save files (ds download, views image -o, convert) output a JSON object with the file path to stdout, enabling agents to chain operations:

# Download and convert in one step
tableau-cli ds download <id> -o ./data/ --to parquet  # → {"filePath": ".../data.parquet"}

# Or as separate steps (useful for keeping the original .tdsx)
tableau-cli ds download <id> -o ./data/               # → {"filePath": ".../data.tdsx"}
tableau-cli convert ./data/data.tdsx -o ./data/        # → {"filePath": ".../data.parquet"}

Error Output

Errors are also structured JSON, designed to guide agents toward resolution:

{
  "isError": true,
  "errorType": "feature-disabled",
  "message": "The VizQL Data Service is disabled on this Tableau Server.",
  "hint": "To enable it, use TSM using the instructions at https://help.tableau.com/..."
}

Error types include: authentication-error, feature-disabled, tableau-api-error, config-error, validation-error, and translated VDS error codes with actionable hints.

API Coverage

Area APIs Used
Authentication REST API v3.24 — PAT sign-in / sign-out
Datasources REST API (list, download) + VizQL Data Service (metadata, query) + Metadata API (GraphQL enrichment)
Views REST API (list, data, image)
Workbooks REST API (list, get with view enrichment)
Search Content Exploration API
Convert Local file conversion: TDSX/HYPER → Parquet/CSV (optional dependencies)

Development

# Run directly
python -m tableau_cli.cli views list

# Install in editable mode
pip install -e .

Acknowledgements

This project is derived from @tableau/mcp-server, adapting its Tableau REST API, VizQL Data Service, and Metadata API integrations into a CLI format.

License

Apache License 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tableau_cli-0.1.2.tar.gz (27.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tableau_cli-0.1.2-py3-none-any.whl (33.2 kB view details)

Uploaded Python 3

File details

Details for the file tableau_cli-0.1.2.tar.gz.

File metadata

  • Download URL: tableau_cli-0.1.2.tar.gz
  • Upload date:
  • Size: 27.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.6

File hashes

Hashes for tableau_cli-0.1.2.tar.gz
Algorithm Hash digest
SHA256 73ea708fa98ea7c43cab2ef41c8614d5f6eca0252d9bd34595217969c3eb8ee6
MD5 0b48fc142a93efea552f7c753f50d0c0
BLAKE2b-256 b3fb9e5a8251289419d9ec343a9f70fded7820149ec80a80d660f4074c1a4213

See more details on using hashes here.

File details

Details for the file tableau_cli-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: tableau_cli-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 33.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.6

File hashes

Hashes for tableau_cli-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f0c9c59830b88df1b4df47dc3ad0fa9efed861affd6d2fb2a43b6935a4bfde69
MD5 409fd757f654f4ea579ceda739f5c351
BLAKE2b-256 8852773b8824a9e2a8a12c0c437192e056dd0ca27a503b6ceeb019ba8a6abff6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page