get_chart
Retrieve complete configuration and metadata for existing Datawrapper charts to understand styling, adapt to new datasets, or clone visualizations.
Instructions
⚠️ DATAWRAPPER MCP TOOL ⚠️ This is part of the Datawrapper MCP server integration.
Get information about an existing Datawrapper chart, including its complete configuration, metadata, and URLs.
The returned configuration can be used to:
Understand how a chart is styled and configured
Adapt the configuration to a new dataset
Clone a chart's styling to create similar visualizations
Returns:
chart_id: The chart's unique identifier
title: Chart title
type: Simplified chart type name (bar, line, stacked_bar, etc.) - same format as used in list_chart_types and create_chart
config: Complete Pydantic model configuration including all styling, colors, axes, tooltips, annotations, and other properties
public_url: Public URL if published
edit_url: Editor URL
Args: chart_id: ID of the chart to retrieve
Returns: Chart information including complete configuration and URLs
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chart_id | Yes |
Implementation Reference
- handlers/retrieve.py:12-39 (handler)The `get_chart_info` function is the handler that implements the logic for "get_chart". It retrieves chart information using the `get_chart` factory function, processes the configuration, and returns the result as `TextContent`.
async def get_chart_info(arguments: GetChartArgs) -> list[TextContent]: """Get information about an existing chart including complete configuration.""" chart_id = arguments["chart_id"] # Get chart using factory function chart = get_chart(chart_id) # Get the complete config config = chart.model_dump() # Convert DataFrame to list of records if data exists if config.get("data") is not None and hasattr(config["data"], "to_dict"): config["data"] = config["data"].to_dict(orient="records") # Convert API type to simplified name for consistency with list_chart_types simplified_type = API_TYPE_TO_SIMPLIFIED.get(chart.chart_type, chart.chart_type) result = { "chart_id": chart.chart_id, "title": chart.title, "type": simplified_type, "config": config, "public_url": chart.get_public_url(), "edit_url": chart.get_editor_url(), } return [TextContent(type="text", text=json.dumps(result, indent=2))] - dw_types.py:34-38 (schema)`GetChartArgs` defines the input schema for the `get_chart` tool handler.
class GetChartArgs(TypedDict): """Arguments for get_chart handler.""" chart_id: str