Skip to content

API reference

The API reference serves mostly as a reference what tools are available to the model and what prompts are available to the user. The Vizro-MCP server works by allowing the LLM to call this set of carefully crafted tools. You will never call these tools directly, but this reference gives an overview over what these tools do and what the model will get as information when deciding which tool to call. Should your host not support tool calling, the usability of the MCP server is limited.

Note

The validate_dashboard_config tool opens a link to a live preview of the dashboard, which will take you to PyCafe. If you don't want to open the link, you can tell the LLM to not do so.

The load_and_analyze_data tool loads a CSV file from a local path or URL into a pandas DataFrame and provides detailed analysis of its structure and content. It only uses pd.read_xxx, so in general there is no need to worry about privacy or data security. However, you should only run Vizro-MCP locally, not as a hosted server, because there is currently no authentication to manage access.

vizro_mcp.server

MCP server for Vizro-AI chart and dashboard creation.

create_dashboard

create_dashboard(
    file_path_or_url=Field(
        description="The absolute path or URL to the data file you want to use."
    ),
    context=Field(
        default=None,
        description="(Optional) Describe the dashboard you want to create.",
    ),
)

Prompt template for creating an EDA dashboard based on one dataset.

create_starter_dashboard

create_starter_dashboard()

Prompt template for getting started with Vizro.

create_vizro_chart

create_vizro_chart(
    file_path_or_url=Field(
        description="The absolute path or URL to the data file you want to use."
    ),
    context=Field(
        default=None,
        description="(Optional) Describe the chart you want to create.",
    ),
)

Prompt template for creating a Vizro chart.

get_model_json_schema

get_model_json_schema(
    model_name=Field(
        description="Name of the Vizro model to get schema for (e.g., 'Card', 'Dashboard', 'Page')"
    ),
)

Get the JSON schema for the specified Vizro model.

Returns:

  • ModelJsonSchemaResults

    JSON schema of the requested Vizro model

get_sample_data_info

get_sample_data_info(
    data_name=Field(
        description="Name of the dataset to get sample data for"
    ),
)

If user provides no data, use this tool to get sample data information.

Use the following data for the below purposes
  • iris: mostly numerical with one categorical column, good for scatter, histogram, boxplot, etc.
  • tips: contains mix of numerical and categorical columns, good for bar, pie, etc.
  • stocks: stock prices, good for line, scatter, generally things that change over time
  • gapminder: demographic data, good for line, scatter, generally things with maps or many categories

Returns:

  • DFMetaData

    Data info object containing information about the dataset.

get_vizro_chart_or_dashboard_plan

get_vizro_chart_or_dashboard_plan(
    user_plan=Field(
        description="The type of Vizro thing the user wants to create"
    ),
    user_host=Field(
        description="The host the user is using, if 'ide' you can use the IDE/editor to run python code"
    ),
    advanced_mode=Field(
        default=False,
        description="Only call if you need to use custom CSS, custom components or custom actions.\nNo need to call this with advanced_mode=True if you need advanced charts,\nuse `custom_charts` in the `validate_dashboard_config` tool instead.",
    ),
)

Get instructions for creating a Vizro chart or dashboard. Call FIRST when asked to create Vizro things.

Must be ALWAYS called FIRST with advanced_mode=False, then call again with advanced_mode=True if the JSON config does not suffice anymore.

Returns:

  • str

    Instructions for creating a Vizro chart or dashboard

load_and_analyze_data

load_and_analyze_data(
    path_or_url=Field(
        description="Absolute (important!) local file path or URL to a data file"
    ),
)

Use to understand local or remote data files. Must be called with absolute paths or URLs.

Supported formats: - CSV (.csv) - JSON (.json) - HTML (.html, .htm) - Excel (.xls, .xlsx) - OpenDocument Spreadsheet (.ods) - Parquet (.parquet)

Returns:

  • DataAnalysisResults

    DataAnalysisResults object containing DataFrame information and metadata

validate_chart_code

validate_chart_code(
    chart_config=Field(
        description="A ChartPlan object with the chart configuration"
    ),
    data_info=Field(
        description="Metadata for the dataset to be used in the chart"
    ),
    auto_open=Field(
        default=True,
        description="Whether to automatically open the PyCafe link in a browser",
    ),
)

Validate the chart code created by the user and optionally open the PyCafe link in a browser.

Returns:

  • ValidateResults

    ValidationResults object with status and dashboard details

validate_dashboard_config

validate_dashboard_config(
    dashboard_config=Field(
        description="Either a JSON string or a dictionary representing a Vizro dashboard model configuration"
    ),
    data_infos=Field(
        description="List of DFMetaData objects containing information about the data files"
    ),
    custom_charts=Field(
        description="List of ChartPlan objects containing information about the custom charts in the dashboard"
    ),
    auto_open=Field(
        default=True,
        description="Whether to automatically open the PyCafe link in a browser",
    ),
)

Validate Vizro model configuration. Run ALWAYS when you have a complete dashboard configuration.

If successful, the tool will return the python code and, if it is a remote file, the py.cafe link to the chart. The PyCafe link will be automatically opened in your default browser if auto_open is True.

Returns:

  • ValidateResults

    ValidationResults object with status and dashboard details