Skip to main content
Glama
hqu

Datawrapper MCP

by hqu

get_chart_schema

Retrieve the JSON schema for Datawrapper chart types to discover styling and configuration options, including properties, types, and default values.

Instructions

⚠️ DATAWRAPPER MCP TOOL ⚠️ This is part of the Datawrapper MCP server integration.


Get the Pydantic JSON schema for a specific chart type. This is your primary tool for discovering styling and configuration options.

The schema shows:

  • All available properties and their types

  • Enum values (e.g., line widths, interpolation methods)

  • Default values

  • Detailed descriptions for each property

WORKFLOW: Use this tool first to explore options, then refer to https://datawrapper.readthedocs.io/en/latest/ for detailed examples and patterns showing how to use these properties in practice.

Args: chart_type: Chart type to get schema for

Returns: JSON schema for the chart type

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chart_typeYes

Implementation Reference

  • Implementation of the get_chart_schema tool.
    async def get_chart_schema(arguments: GetChartSchemaArgs) -> list[TextContent]:
        """Get the Pydantic schema for a chart type."""
        chart_type = arguments["chart_type"]
    
        if chart_type in MAP_TYPE_ALIASES:
            result = {
                "chart_type": chart_type,
                "class_name": "MapChart (API-backed)",
                "schema": {
                    "type": "object",
                    "description": (
                        "Map chart config passed through to Datawrapper metadata. "
                        "Common fields include title, intro, notes, byline, source-name, "
                        "source-url, aria-description, tooltip-title, tooltip-body, "
                        "tooltip-enabled, and tooltip-sticky."
                    ),
                    "additionalProperties": True,
                },
                "usage": (
                    "Map chart types are created via Datawrapper's raw chart-type API. "
                    "Provide chart_config fields as high-level Datawrapper metadata keys."
                ),
            }
            return [TextContent(type="text", text=json.dumps(result, indent=2))]
    
        chart_class: type[Any] = CHART_CLASSES[chart_type]
    
        schema = chart_class.model_json_schema()
    
        # Remove examples that contain DataFrames (not JSON serializable)
        if "examples" in schema:
            del schema["examples"]
    
        result = {
            "chart_type": chart_type,
            "class_name": chart_class.__name__,
            "schema": schema,
            "usage": (
                "Use this schema to construct a chart_config dict for create_chart_advanced. "
                "The schema shows all available properties, their types, and descriptions."
            ),
        }
    
        return [TextContent(type="text", text=json.dumps(result, indent=2))]
  • Type definition for the arguments of get_chart_schema.
    class GetChartSchemaArgs(TypedDict):
        """Arguments for get_chart_schema handler."""
    
        chart_type: 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