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

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

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
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It discloses that the tool returns a JSON schema with details like properties, types, enums, defaults, and descriptions, which helps the agent understand the output format. However, it doesn't mention potential errors (e.g., invalid chart types), rate limits, or authentication needs, leaving some behavioral gaps. No contradiction with annotations exists.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with sections (e.g., workflow, args, returns) and uses bullet points for clarity. It's front-loaded with the core purpose. However, the warning banner and markdown formatting add some verbosity that isn't strictly necessary, slightly reducing efficiency. Overall, most sentences earn their place by providing useful information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (1 parameter), no annotations, and the presence of an output schema (which handles return values), the description is complete enough. It covers purpose, usage guidelines, parameter semantics, and output expectations. The reference to external documentation adds extra context, making it suitable for an agent to invoke the tool correctly without gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 0%, so the description must compensate. It adds meaning by explaining that 'chart_type' is used to 'get schema for a specific chart type,' implying it's an identifier for chart types (e.g., 'line', 'bar'). While it doesn't list possible values or formats, it clarifies the parameter's role beyond the basic schema. With only one parameter, this is sufficient for a high score.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Get the Pydantic JSON schema for a specific chart type.' It specifies the verb ('Get') and resource ('Pydantic JSON schema'), and distinguishes it from siblings like 'create_chart' or 'update_chart' by focusing on schema discovery rather than chart manipulation. The mention of 'primary tool for discovering styling and configuration options' further clarifies its exploratory role.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit usage guidance: 'Use this tool first to explore options,' indicating it should be used before other tools like 'create_chart' or 'update_chart.' It also references an external resource ('https://datawrapper.readthedocs.io/') for detailed examples, offering a clear workflow. This effectively distinguishes when to use this tool versus alternatives in the sibling list.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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