twilize
twilize
用于可重现仪表板和工作簿工程的 Tableau 工作簿 (.twb/.twbx) 生成工具包 通过稳定的分析原语、仪表板组合和内置的结构验证,以编程方式创建 Tableau 工作簿。
概述
twilize 是一个模型上下文协议 (MCP) 服务器和 Python 工具包,用于通过代码或 AI 驱动的工具调用生成 Tableau Desktop 工作簿文件 (.twb / .twbx)。
它被设计为工作簿工程层,而不是对话式数据探索代理。其目标是使工作簿生成过程可重现、可检查,并能安全地在本地工作流、脚本和 CI 中实现自动化。
默认工作流为:
从已知模板 (
.twb或.twbx) 或内置的零配置模板开始添加计算字段和参数
使用稳定的图表原语构建工作表
组装仪表板和交互
保存并验证可在 Tableau Desktop 中打开的
.twb或.twbx文件
Interfaces
┌───────────────────────────────────────────────────────────────┐
│ ┌──────────────────────────┐ ┌───────────────────────────┐ │
│ │ MCP Server │ │ Python Library │ │
│ │ tools_workbook │ │ from twilize.twb_editor │ │
│ │ tools_layout │ │ import TWBEditor │ │
│ │ tools_migration │ │ │ │
│ │ tools_support │ │ editor.add_...() │ │
│ │ │ │ editor.configure_...() │ │
│ │ (Claude / Cursor / │ │ editor.save(...) │ │
│ │ VSCode / Claude Code) │ │ │ │
│ └─────────────┬────────────┘ └──────────────┬────────────┘ │
│ └──────────────┬────────────────┘ │
└───────────────────────────── ┼ ─────────────────────────────┘
▼
┌───────────────────────────────────────────────────────────────┐
│ TWBEditor │
│ ParametersMixin · ConnectionsMixin │
│ ChartsMixin · DashboardsMixin │
└──────────┬──────────────────┬──────────────────┬─────────────┘
▼ ▼ ▼
┌──────────────────┐ ┌──────────────┐ ┌──────────────────────┐
│ Chart Builders │ │ Dashboard │ │ Analysis & │
│ │ │ System │ │ Migration │
│ Basic DualAxis │ │ │ │ │
│ Pie Text │ │ layouts │ │ migration.py │
│ Map Recipes │ │ actions │ │ twb_analyzer.py │
│ │ │ dependencies│ │ capability_registry │
└────────┬─────────┘ └──────┬───────┘ └──────────┬───────────┘
└───────────────────┼──────────────────────┘
▼
┌───────────────────────────────────────────────────────────────┐
│ XML Engine (lxml) │
│ template.twb/.twbx → patch → validate → save │
└───────────────────────────────┬───────────────────────────────┘
▼
output.twb / output.twbx安装
pip install twilize要运行捆绑的基于 Hyper 的示例(该示例检查 .hyper 文件并自动解析物理 Orders_* 表),请同时安装可选的示例依赖项:
pip install "twilize[examples]"要求
快速入门
作为 MCP 服务器
要允许 MCP 客户端自动构建 Tableau 工作簿,请将 twilize 添加到该客户端的 MCP 配置中。
启动命令在不同客户端中是相同的:
uvx twilize每个客户端以不同的配置格式存储此命令。请使用下方的匹配示例。
Claude Desktop
在 macOS 上打开 ~/Library/Application Support/Claude/claude_desktop_config.json,或在 Windows 上打开 %APPDATA%\Claude\claude_desktop_config.json 并添加:
{
"mcpServers": {
"twilize": {
"command": "uvx",
"args": ["twilize"]
}
}
}Cursor IDE
打开 Cursor Settings -> Features -> MCP
点击 Add New MCP Server
将 Type 设置为
command将 Name 设置为
twilize将 Command 设置为
uvx twilize
Claude Code
claude mcp add twilize -- uvx twilizeVSCode
打开工作区 .vscode/mcp.json 文件或您的用户配置文件 mcp.json 并添加:
{
"servers": {
"twilize": {
"command": "uvx",
"args": ["twilize"]
}
}
}在 VSCode 中,您可以通过命令面板使用 MCP: Open Workspace Folder Configuration 或 MCP: Open User Configuration 打开这些文件。您还可以使用 MCP: Add Server 并通过引导流程输入相同的 uvx twilize 命令。
作为 Python 库
使用 TWBEditor(...) 从模板开始并重建工作簿内容。当您想要保留现有工作表和仪表板并就地重新配置工作表时,请使用 TWBEditor.open_existing(...)。
from twilize.twb_editor import TWBEditor
editor = TWBEditor("") # "" uses the built-in Superstore template
editor.clear_worksheets()
editor.add_calculated_field("Profit Ratio", "SUM([Profit])/SUM([Sales])")
editor.add_worksheet("Sales by Category")
editor.configure_chart(
worksheet_name="Sales by Category",
mark_type="Bar",
rows=["Category"],
columns=["SUM(Sales)"],
)
editor.add_worksheet("Segment Pie")
editor.configure_chart(
worksheet_name="Segment Pie",
mark_type="Pie",
color="Segment",
wedge_size="SUM(Sales)",
)
editor.add_dashboard(
dashboard_name="Overview",
worksheet_names=["Sales by Category", "Segment Pie"],
layout="horizontal",
)
editor.save("output/my_workbook.twb")使用打包工作簿 (.twbx)
.twbx 文件是将工作簿 XML 与数据提取 (.hyper) 和图像资源捆绑在一起的 ZIP 归档文件。twilize 可以透明地读取和写入它们:
from twilize.twb_editor import TWBEditor
# Open a packaged workbook — extracts and images are preserved automatically
editor = TWBEditor.open_existing("templates/dashboard/MyDashboard.twbx")
# Make changes as usual
editor.add_calculated_field("Profit Ratio", "SUM([Profit])/SUM([Sales])")
# Save as .twbx — re-bundles the updated .twb with the original extracts/images
editor.save("output/MyDashboard_v2.twbx")
# Or extract just the XML when the packaged format isn't needed
editor.save("output/MyDashboard_v2.twb")普通的 .twb 也可以被打包:
editor = TWBEditor("templates/twb/superstore.twb")
# ...
editor.save("output/superstore.twbx") # produces a single-entry ZIP with the .twb insideMCP 工具
工具 | 描述 |
| 加载 |
| 打开现有的 |
| 列出所有可用的维度和度量 |
| 列出活动工作簿中的工作表名称 |
| 列出仪表板及其引用的工作表区域 |
| 添加用于假设分析的交互式参数 |
| 添加带有 Tableau 公式的计算字段 |
| 移除先前添加的计算字段 |
| 添加新的空白工作表 |
| 配置图表类型和字段映射 |
| 应用工作表级样式:背景颜色、轴/网格/边框可见性 |
| 配置双轴图表组合 |
| 配置展示型配方图表,如 |
| 创建组合工作表的仪表板 |
| 向仪表板添加筛选器或高亮操作 |
| 构建交互式结构化仪表板 flexbox 布局 |
| 显示 twilize 声明的支持边界 |
| 解释图表或功能是核心、高级、配方还是不受支持 |
| 根据能力目录分析 |
| 总结模板的非核心差距 |
| 根据官方 Tableau TWB XSD 架构 (2026.1) 验证工作簿 |
| 运行内置的 TWB 迁移工作流,并在需要时暂停以确认警告 |
| 配置数据源以使用本地 MySQL 连接 |
| 配置到在线 Tableau Server 的连接 |
| 配置数据源以使用本地 Hyper 提取连接 |
| 将工作簿保存为 |
能力模型
核心原语
这些是项目应持续承诺的稳定构建块:
条形图
折线图
面积图
饼图
地图
文本 / KPI 卡片
参数和计算字段
基本仪表板组合
高级模式
这些受支持,但它们是更高级的组合或交互功能,而不是默认的表面区域:
散点图
热力图
树状图
气泡图
双轴 —
mark_color_1/2,color_map_1,reverse_axis_1,hide_zeroline,synchronized表计算 — 通过
add_calculated_field(table_calc="Rows")使用RANK_DENSE,RUNNING_SUM,WINDOW_SUMKPI 差异徽章 —
MIN(1)虚拟轴 +axis_fixed_range+color_map+customized_label环形图(通过 extra_axes) — 多窗格饼图 + 使用
configure_dual_axis(extra_axes=[...])的白色圆圈;支持:Measure Names调色板的color_map富文本标签 — 用于多样式 KPI 卡片和带有内联字段值的动态标题的
configure_chart(label_runs=[...])高级工作表样式 —
configure_worksheet_style支持窗格级单元格/数据标签/标记样式、每个字段的标签/单元格/标题格式、轴刻度控制、禁用工具提示以及所有 Tableau 视觉噪声抑制行维度标题抑制 —
configure_worksheet_style(hide_row_label="FieldName")筛选器区域、参数控件、颜色图例
仪表板筛选器和高亮操作
声明式 JSON 布局工作流
通过布局字典中的
show_title: false进行仪表板区域标题控制
配方和展示模式
这些今天可以生成,但应被视为配方或示例,而不是一等承诺:
环形图
棒棒糖图
子弹图
凹凸图
蝴蝶图
日历图
配方图表有意通过单个 configure_chart_recipe 工具公开,因此公共 MCP 表面不会为每个展示模式逐个增加工具。
这种区别很重要,因为 twilize 并不试图成为图表动物园或与 Tableau 自己的对话式分析工具竞争。当它提供一个可靠、可自动化的工作簿生成层时,该项目最强大。
能力优先工作流
当您不确定某项功能是否属于稳定的 SDK 表面时:
使用
list_capabilities检查声明的边界使用
describe_capability检查特定的图表、编码或功能在追逐展示模板之前使用
analyze_twb或diff_template_gap
这使新功能工作与项目的实际产品边界保持一致,而不是与示例工作簿中碰巧出现的任何内容保持一致。
内置验证
结构验证
save() 在写入前会自动验证 TWB XML 结构:
致命错误(如缺少
<workbook>或<datasources>)会引发TWBValidationError警告(如缺少
<view>或<panes>)会被记录但不会阻止保存可以使用
editor.save("output.twb", validate=False)或editor.save("output.twbx", validate=False)禁用验证
XSD 架构验证
TWBEditor.validate_schema() 根据官方 Tableau TWB XSD 架构 (2026.1) 检查工作簿,该架构位于 vendor/tableau-document-schemas/:
result = editor.validate_schema()
print(result.to_text())
# PASS Workbook is valid against Tableau TWB XSD schema (2026.1)
# — or —
# FAIL Schema validation failed (2 error(s)):
# * Element 'workbook': Missing child element(s)...
result.valid # bool
result.errors # list[str] — lxml error messages
result.schema_available # False if the vendor submodule is not checked out相同的检查可用作 MCP 工具:
validate_workbook() # validate current open workbook in memory
validate_workbook(file_path="out.twb") # validate a file on disk (.twb or .twbx)XSD 错误是信息性的——Tableau 本身生成的工作簿偶尔会偏离架构——但反复出现的错误预示着值得修复的结构性问题。
仪表板布局
布局 | 描述 |
| 从上到下堆叠工作表 |
| 并排放置工作表 |
| 最多四个工作表的 2x2 网格布局 |
| 用于更复杂仪表板的声明式自定义布局 |
自定义布局可以使用嵌套的 layout 字典以编程方式构建,或通过 generate_layout_json 用于 MCP 工作流。
基于 Hyper 的示例
examples/hyper_and_new_charts.py 示例使用直接捆绑在包中的 Sample - EU Superstore.hyper 提取 (src/twilize/references/),并在切换工作簿连接之前通过 Tableau Hyper API 解析物理 Orders_* 表。无需克隆存储库 — 使用 pip install "twilize[examples]" 安装并直接运行。
工作簿迁移
twilize 包含一个迁移子系统,用于将现有的 .twb 切换到新的数据源——例如,将基于一个 Excel 文件构建的工作簿重新指向具有不同架构的另一个 Excel,或在同一数据集的语言变体之间进行迁移。
工作原理
迁移是一个多步骤工作流。每个步骤都可用作 MCP 工具和 Python 函数:
1. inspect_target_schema → Scan the target Excel and list its columns
2. profile_twb_for_migration → Inventory which fields the workbook uses
3. propose_field_mapping → Match source fields to target columns (fuzzy)
4. preview_twb_migration → Dry-run: show what would change, blockers/warnings
5. apply_twb_migration → Write the migrated .twb + JSON reportsmigrate_twb_guided 是一个便捷包装器,它按顺序运行步骤 2–5,并在仅剩下低置信度字段匹配时自动暂停,返回一个 warning_review_bundle 供人工审查,然后再继续。
Python 示例
from twilize.migration import migrate_twb_guided_json
import json
# One-call guided migration
result = migrate_twb_guided_json(
file_path="templates/SalesDashboard.twb",
target_source="data/new_data_source.xlsx",
output_path="output/SalesDashboard_migrated.twb",
)
bundle = json.loads(result)
if bundle["status"] == "warning_review_required":
# Inspect low-confidence matches and confirm or override them
print(bundle["warning_review_bundle"])
# Re-run with confirmed mappings
result = migrate_twb_guided_json(
file_path="templates/SalesDashboard.twb",
target_source="data/new_data_source.xlsx",
output_path="output/SalesDashboard_migrated.twb",
mapping_overrides={"Old Field Name": "New Column Name"},
)MCP 工具示例
当将 twilize 用作 MCP 服务器时,AI 代理可以运行完整的工作流:
inspect_target_schema(target_source="data/new_data_source.xlsx")
→ returns column list and data types
migrate_twb_guided(
file_path="templates/SalesDashboard.twb",
target_source="data/new_data_source.xlsx",
output_path="output/SalesDashboard_migrated.twb"
)
→ returns status: "applied" or "warning_review_required"输出文件
完成的迁移会写入三个文件:
文件 | 内容 |
| 带有重写字段引用的已迁移工作簿 |
| 每个字段的状态:已映射 / 警告 / 已阻止 |
| 用于审计的最终源→目标字段映射 |
范围参数
scope="workbook" 迁移所有工作表。传递工作表名称以将迁移限制为单个工作表。
自包含示例
examples/migrate_workflow/ 包含一个模板 .twb、原始 Superstore Excel、目标中文区域设置的 Superstore Excel 和一个可运行的脚本:
python examples/migrate_workflow/test_migration_workflow.py项目结构
twilize/
|-- src/twilize/
| |-- __init__.py
| |-- capability_registry.py
| |-- config.py
| |-- charts/
| |-- connections.py
| |-- dashboard_actions.py
| |-- dashboard_dependencies.py
| |-- dashboard_layouts.py
| |-- dashboards.py
| |-- field_registry.py
| |-- layout.py
| |-- layout_model.py
| |-- layout_rendering.py
| |-- mcp/
| |-- parameters.py
| |-- twb_analyzer.py
| |-- twb_editor.py
| |-- validator.py
| `-- server.py
|-- tests/
|-- examples/
|-- docs/
|-- pyproject.toml
`-- README.md开发
# Install in editable mode
pip install -e .
# Run test suite
pytest --basetemp=output/pytest_tmp
# Run the mixed showcase example
python examples/scripts/demo_all_supported_charts.py
# Run the advanced Hyper-backed example
python examples/scripts/demo_hyper_and_new_charts.py
# Run the guided migration example
python examples/migrate_workflow/test_migration_workflow.py
# Start MCP server
twilizeMCP 服务器清单
twilize 附带一个完整的 MCP 服务器清单 (mcp-server.json)——这是 Tableau Extension .trex 文件的 MCP 等效文件。它声明了:
.trex 等效项 | MCP 字段 | 描述 |
扩展 ID |
|
|
版本 |
| 当前包版本 |
名称 / 描述 |
| 服务器标识 |
作者 |
| 名称、电子邮件、组织、URL |
权限 |
|
|
源 URL |
|
|
最低 API 版本 |
|
|
此外,该清单声明了所有 40 个带有类别的工具、6 个资源,以及针对 Claude Desktop、Cursor、VS Code 和 Claude Code 的预构建客户端配置。
有关带有参数架构的完整工具参考,请参阅 docs/MCP_SERVER.md。
发布
PyPI
pip install build twine
python -m build
twine upload dist/*Smithery MCP 注册表
smithery.yaml 文件已准备好提交至 Smithery。
MCP 服务器注册表
mcp-server.json 文件遵循用于注册表提交的 MCP 服务器架构。
许可证
AGPL-3.0-or-later
Available Tools
55 toolsadd_calculated_fieldC
Add a calculated field to the datasource.
Inputs: field_name (required), formula (required), datatype, role, +2 more. Returns: result
add_dashboardB
Create a dashboard combining multiple worksheets.
Inputs: dashboard_name (required), worksheet_names (required), width, height, +1 more. Returns: result
add_dashboard_actionC
Add an interaction action to a dashboard.
Inputs: dashboard_name (required), action_type (required), source_sheet (required), target_sheet (required), +3 more. Returns: result
add_parameterC
Add a parameter to the workbook.
Inputs: name (required), datatype, default_value, domain_type, +5 more. Returns: result
add_reference_bandC
Add a reference band (shaded region) to a worksheet.
Inputs: worksheet_name (required), axis_field (required), from_value, to_value, +4 more. Returns: result
add_reference_lineC
Add a reference line to a worksheet (constant, average, median, etc.).
Inputs: worksheet_name (required), axis_field (required), value, formula, +4 more. Returns: result
add_trend_lineB
Add a trend line to a worksheet (linear, polynomial, log, exp, power).
Inputs: worksheet_name (required), fit, degree, show_confidence_bands, +1 more. Returns: result
add_worksheetC
Add a new blank worksheet to the workbook.
Inputs: worksheet_name (required). Returns: result
analyze_twbC
Analyze a TWB file against twilize's declared capabilities.
Inputs: file_path (required). Returns: result
apply_color_paletteC
Set a custom color palette. Built-in: tableau10, tableau20, blue-red, green-gold.
Inputs: palette_name, colors, custom_name. Returns: result
apply_dashboard_themeC
Apply uniform styling (background, font) to all zones in a dashboard.
Inputs: dashboard_name (required), background_color, font_family, title_font_size. Returns: result
apply_twb_migrationC
Apply a workbook migration and write a migrated TWB plus reports.
Inputs: file_path (required), target_source (required), output_path (required), scope, +1 more. Returns: result
configure_chartC
Configure chart type and field mappings for a worksheet.
Inputs: worksheet_name (required), mark_type, columns, rows, +19 more. Returns: result
configure_chart_recipeB
Configure a showcase recipe chart through the shared recipe registry.
Inputs: worksheet_name (required), recipe_name (required), recipe_args, auto_ensure_prerequisites. Returns: result
configure_dual_axisD
Configure a dual-axis chart composition.
Inputs: worksheet_name (required), mark_type_1, mark_type_2, columns, +25 more. Returns: result
configure_worksheet_styleB
Apply worksheet-level styling: background color, axis/grid/border visibility.
Inputs: worksheet_name (required), background_color, hide_axes, hide_gridlines, +17 more. Returns: result
create_workbookC
Create a new workbook from a TWB or TWBX template file.
Inputs: template_path, workbook_name. Returns: result
csv_to_dashboardA
Build a complete Tableau dashboard from a CSV file (end-to-end).
Pipeline: CSV → schema inference → chart suggestion → Hyper extract → workbook creation → chart configuration → dashboard layout → .twbx output.
Args: csv_path: Path to the source CSV file. output_path: Output .twbx path (defaults to <csv_stem>_dashboard.twbx). dashboard_title: Dashboard title (derived from filename if empty). max_charts: Maximum number of charts (0 = use dashboard_rules.yaml default). template_path: TWB template path (empty for default template). theme: Theme preset name (empty = use dashboard_rules.yaml default). Options: modern-light, modern-dark, classic, minimal, vibrant. rules_yaml: Optional YAML string with dashboard rules overrides. Example: "kpi:\n font_size: 32\n max_kpis: 3"
Returns: Summary of the created dashboard with file path.
Inputs: csv_path (required), output_path, dashboard_title, max_charts, +3 more. Returns: result
csv_to_hyperA
Convert a CSV file to a Tableau Hyper extract.
Infers column types and creates a .hyper file that can be used as a data source in Tableau workbooks.
Requires tableauhyperapi (pip install tableauhyperapi).
Args: csv_path: Path to the source CSV file. hyper_path: Output path for the .hyper file. table_name: Table name inside the Hyper file. sample_rows: Rows to sample for type inference.
Returns: Confirmation with row and column counts.
Inputs: csv_path (required), hyper_path (required), table_name, sample_rows. Returns: result
describe_capabilityB
Describe one declared capability and its support tier.
Inputs: kind (required), name (required). Returns: result
diff_template_gapC
Summarize the non-core capability gap of a TWB template.
Inputs: file_path (required). Returns: result
export_rulesA
Export the current active rules to a YAML file.
Saves the complete rules (including any runtime changes from set_rule()) to a YAML file that can be placed next to data files or in the working directory for future sessions.
Args: output_path: Path to save the YAML file. Defaults to ./dashboard_rules.yaml in the current working directory.
Returns: Path to the saved file and summary.
Inputs: output_path. Returns: result
generate_layout_jsonC
Generate and save a dashboard layout JSON file.
Inputs: output_path (required), layout_tree (required), ascii_preview (required). Returns: result
get_active_rulesA
Return the active dashboard creation rules.
Call this at the start of a session to understand what constraints are enforced. The rules engine validates every configure_chart and add_dashboard call — violations are returned as errors or warnings.
Returns: Human-readable summary of all active rules.
Inputs: no named parameters. Returns: result
hyper_to_dashboardA
Build a complete Tableau dashboard from a Hyper extract file (end-to-end).
Pipeline: Hyper → schema inference → chart suggestion → workbook creation → chart configuration → dashboard layout → .twbx output.
Args: hyper_path: Path to the .hyper file. output_path: Output .twbx path (defaults to <hyper_stem>_dashboard.twbx). dashboard_title: Dashboard title (derived from filename if empty). max_charts: Maximum number of charts (0 = use rules default). template_path: TWB template path (empty for default template). table_name: Table name inside the Hyper file (empty = first table). theme: Theme preset name (empty = use rules default). rules_yaml: Optional YAML string with dashboard rules overrides.
Returns: Summary of the created dashboard with file path.
Inputs: hyper_path (required), output_path, dashboard_title, max_charts, +4 more. Returns: result
inspect_csvA
Inspect a CSV file and return its inferred schema with column classification.
Reads the CSV, infers column types (integer, float, date, boolean, string), classifies columns as dimensions or measures with semantic types (categorical, temporal, geographic, numeric), and returns a summary.
Args: csv_path: Path to the CSV file. sample_rows: Number of rows to sample for type inference. encoding: File encoding (default utf-8).
Returns: Human-readable schema summary with dimensions, measures, and types.
Inputs: csv_path (required), sample_rows, encoding. Returns: result
inspect_hyperA
Inspect a Hyper extract file and return its schema with column classification.
Reads the Hyper file, maps column types, classifies columns as dimensions or measures, and returns a summary.
Requires tableauhyperapi (pip install tableauhyperapi).
Args: hyper_path: Path to the .hyper file. table_name: Specific table to inspect (empty = first table).
Returns: Human-readable schema summary with dimensions, measures, and types.
Inputs: hyper_path (required), table_name. Returns: result
inspect_target_schemaB
Inspect the first-sheet schema of a target Excel datasource.
Inputs: target_source (required). Returns: result
list_capabilitiesB
List twilize's declared capability boundary.
Inputs: no named parameters. Returns: result
list_dashboardsA
List dashboards and their worksheet zones in the current workbook.
Inputs: no named parameters. Returns: result
list_fieldsA
List all available fields in the current workbook datasource.
Inputs: no named parameters. Returns: result
list_gallery_templatesA
List all templates in the gallery with suitability rules.
Templates are user-editable YAML files in templates/gallery/.
Each template defines layout zones, suitability criteria, recommended
themes, and auto-wired interaction actions.
Returns: Formatted listing of all gallery templates.
Inputs: no named parameters. Returns: result
list_worksheetsA
List worksheet names in the current workbook.
Inputs: no named parameters. Returns: result
migrate_twb_guidedC
Run the built-in migration workflow and pause for warning confirmation when needed.
Inputs: file_path (required), target_source (required), output_path, scope, +2 more. Returns: result
mssql_to_dashboardA
Build a Tableau dashboard from a Microsoft SQL Server table (end-to-end).
Pipeline: MSSQL → schema inference → chart suggestion → workbook creation → live MSSQL connection → .twb output.
Requires pyodbc for schema inference and ODBC Driver 17 for SQL Server.
Args: server_host: MSSQL server hostname. dbname: Database name. table_name: Table to visualize. username: Database username (ignored if trusted_connection=True). password: Database password (used for schema inference only). port: Server port (default 1433). trusted_connection: Use Windows Authentication instead of SQL auth. output_path: Output .twb path (defaults to _dashboard.twb). dashboard_title: Dashboard title. max_charts: Maximum charts (0 = use rules default). template_path: TWB template path. theme: Theme preset name. rules_yaml: Optional YAML string with dashboard rules overrides.
Returns: Summary of the created dashboard with file path.
Inputs: server_host (required), dbname (required), table_name (required), username, +9 more. Returns: result
mysql_to_dashboardA
Build a Tableau dashboard from a MySQL table (end-to-end).
Pipeline: MySQL → schema inference → chart suggestion → workbook creation → live MySQL connection → .twb output.
Requires mysql-connector-python for schema inference.
Args: server_host: MySQL server hostname. dbname: Database name. table_name: Table to visualize. username: Database username. password: Database password (used for schema inference only; not stored in the workbook). port: Server port (default 3306). output_path: Output .twb path (defaults to _dashboard.twb). dashboard_title: Dashboard title. max_charts: Maximum charts (0 = use rules default). template_path: TWB template path. theme: Theme preset name. rules_yaml: Optional YAML string with dashboard rules overrides.
Returns: Summary of the created dashboard with file path.
Inputs: server_host (required), dbname (required), table_name (required), username (required), +8 more. Returns: result
open_workbookA
Open an existing workbook (.twb or .twbx) for in-place worksheet editing.
Inputs: file_path (required). Returns: result
preview_twb_migrationC
Preview a workbook migration onto a target datasource.
Inputs: file_path (required), target_source (required), scope, mapping_overrides. Returns: result
profile_csvA
Profile a CSV file before connecting it.
Unlike profile_data_source (which needs an active workbook), this tool profiles a raw CSV file directly.
Args: csv_path: Path to the CSV file. sample_rows: Number of rows to sample for type inference.
Returns: Human-readable DataProfile.
Inputs: csv_path (required), sample_rows. Returns: result
profile_data_sourceA
Profile the currently connected data source.
Works for ANY connection type: CSV extract, Hyper, MySQL, Tableau Server, Excel — anything that has fields in the workbook. The profile includes dimension/measure classification, semantic types, domain hints, and boolean signals that guide chart and template selection.
Args: source_type: Override source detection. Usually "auto" which inspects the workbook fields. Other options: "csv", "hyper" (requires separate file path tools).
Returns: Human-readable DataProfile with signals for template/chart decisions.
Inputs: source_type. Returns: result
profile_twb_for_migrationB
Profile workbook datasources and worksheet scope before migration.
Inputs: file_path (required), scope, target_source. Returns: result
propose_field_mappingC
Scan source and target schema and propose a field mapping.
Inputs: file_path (required), target_source (required), scope, mapping_overrides. Returns: result
recommend_templateA
Score all gallery templates and recommend the best fit.
Call this AFTER profiling the data source and deciding on chart types, but BEFORE creating the dashboard layout. The decider evaluates every template in the gallery against the data profile and chart mix, returning a ranked list with reasoning.
Args: chart_types: Comma-separated list of chart mark_types being built. Example: "Bar,Line,Text,Text,Map" If omitted, uses only the data profile signals. kpi_count: Override KPI count (else derived from chart_types).
Returns: Ranked template recommendations with scores and reasoning.
Inputs: chart_types, kpi_count. Returns: result
recommend_template_for_csvB
Recommend templates for a CSV file (no active workbook needed).
Args: csv_path: Path to the CSV file. chart_types: Comma-separated chart types (optional). sample_rows: Rows to sample for inference.
Returns: Ranked template recommendations.
Inputs: csv_path (required), chart_types, sample_rows. Returns: result
remove_calculated_fieldA
Remove a previously added calculated field.
Inputs: field_name (required). Returns: result
reset_rulesA
Reset all rules to the built-in defaults.
Discards any runtime changes made via set_rule() and reloads the default rules from the package YAML file.
Returns: Confirmation message.
Inputs: no named parameters. Returns: result
save_workbookA
Save the workbook as a TWB file. Use a .twbx extension to produce a packaged workbook (ZIP) that bundles the XML with any data extracts and images carried over from the source .twbx.
Inputs: output_path (required). Returns: result
set_hyper_connectionC
Configure the workbook datasource to use a local Hyper extract connection.
Inputs: filepath (required), table_name, tables. Returns: result
set_mssql_connectionC
Configure the workbook datasource to use a Microsoft SQL Server connection.
Inputs: server_host (required), dbname (required), username (required), table_name (required), +1 more. Returns: result
set_mysql_connectionC
Configure the workbook datasource to use a local MySQL connection.
Inputs: server (required), dbname (required), username (required), table_name (required), +1 more. Returns: result
set_ruleA
Set a specific rule value in the active dashboard rules.
This allows admins to modify rules at runtime without editing YAML files. Changes persist for the current session and can be exported with export_rules().
Args: section: Rule section name. Options: "kpi" — KPI formatting (font_size, font_color, bold, row_height, max_kpis, default_format) "charts" — Chart defaults (max_charts, theme, bar_top_n, pie_max_slices) "layout" — Layout settings (width, height, background_color, card_background) "bar_chart_rules" — Bar chart enforcement "theme_rules" — Theme enforcement "map_rules" — Map chart enforcement key: The specific setting to change. Examples: "font_size", "max_charts", "theme", "background_color", "default_format" value: New value (string — will be auto-parsed to int/float/bool as needed). Examples: "28", "modern-dark", "#2D2D2D", "true", "$#,##0.00"
Returns: Confirmation of the change or error message.
Inputs: section (required), key (required), value (required). Returns: result
set_tableauserver_connectionB
Configure the workbook datasource to use a Tableau Server connection.
Inputs: server (required), dbname (required), username (required), table_name (required), +2 more. Returns: result
suggest_charts_for_csvA
Suggest chart types and configurations for a CSV file.
Analyzes the data shape (dimensions, measures, temporal fields, etc.) and returns prioritized chart suggestions with shelf assignments.
Args: csv_path: Path to the CSV file. max_charts: Maximum number of charts to suggest (0 = use dashboard_rules.yaml default). sample_rows: Rows to sample for inference. rules_yaml: Optional YAML string with dashboard rules overrides (e.g. KPI formatting, chart limits).
Returns: Formatted suggestion list with chart types, shelf assignments, and reasoning.
Inputs: csv_path (required), max_charts, sample_rows, rules_yaml. Returns: result
undo_last_changeA
Undo the last mutating operation, restoring the previous workbook state.
Inputs: no named parameters. Returns: result
validate_workbookA
Run an informational XSD schema check on a workbook (2026.1 schema).
This is a non-blocking, advisory check only. Tableau Desktop is the true validator — it routinely produces workbooks that deviate from the published XSD schema, so deviations reported here do NOT indicate the workbook is broken. The workbook will almost certainly open correctly in Tableau regardless of any deviations found.
Args: file_path: Path to a .twb or .twbx file to check. If omitted, checks the currently open workbook (in memory).
Returns: Informational summary of schema deviations (if any).
Inputs: file_path. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 55 tools
Many tools overlap in purpose: configure_chart vs configure_chart_recipe, profile_data_source vs profile_csv vs inspect_csv vs inspect_hyper, recommend_template vs recommend_template_for_csv, and multiple *_to_dashboard tools that differ only by data source. The descriptions help somewhat, but the boundaries between profiling/inspection and chart configuration tools are unclear.
Most tools follow a verb_noun pattern (e.g., add_worksheet, save_workbook, list_fields), but there are inconsistencies: some use 'inspect_' vs 'profile_' for similar operations, 'generate_layout_json' vs 'create_workbook', and 'migrate_twb_guided' vs 'apply_twb_migration' use different verb styles. The pattern is readable but not uniform.
55 tools is excessive for a single MCP server, even one covering Tableau workbook creation, migration, and dashboard generation. Many tools are variants of the same operation (e.g., five *_to_dashboard tools, three profile tools, two recommend_template tools), suggesting the surface could be consolidated to 20-30 tools.
The tool set covers the full pipeline from data source inspection (CSV, Hyper, MySQL, MSSQL) through workbook creation, chart configuration, dashboard layout, and export. Minor gaps exist (e.g., no explicit tool for editing existing dashboards beyond adding actions, no delete/remove worksheet tool), but the core lifecycle is well covered.
Related MCP Connectors
MCP server for progressive tool usage at any scale (see https://klavis.ai)
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
A Model Context Protocol server for Wix AI tools
Model Context Protocol server for the Apideck Unified API. Connect any MCP-compatible agent framework to 100+ accounting systems, HRIS platforms, file storage providers, and more through one integration. More information https://www.apideck.com/mcp-server