Skip to main content
Glama
hqu

Datawrapper MCP

by hqu

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

TableJSON Schema
NameRequiredDescriptionDefault
chart_idYes

Implementation Reference

  • 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))]
  • `GetChartArgs` defines the input schema for the `get_chart` tool handler.
    class GetChartArgs(TypedDict):
        """Arguments for get_chart handler."""
    
        chart_id: str

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/hqu/datawrapper-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server