Skip to main content
Glama
hqu

Datawrapper MCP

by hqu

publish_chart

Publish a Datawrapper chart to make it publicly accessible and obtain its public URL for sharing or embedding.

Instructions

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


Publish a Datawrapper chart to make it publicly accessible. Returns the public URL of the published chart. IMPORTANT: Only use this tool when the user explicitly requests to publish the chart. Do not automatically publish charts after creation unless specifically asked.

Args: chart_id: ID of the chart to publish

Returns: Public URL of the published chart

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chart_idYes

Implementation Reference

  • The actual handler function implementing the publish_chart tool logic.
    async def publish_chart(arguments: PublishChartArgs) -> list[TextContent]:
        """Publish a chart to make it publicly accessible."""
        chart_id = arguments["chart_id"]
    
        # Get chart and publish using Pydantic instance method
        chart = get_chart(chart_id)
        chart.publish()
    
        public_url = chart.get_public_url()
    
        result = {
            "chart_id": chart_id,
            "public_url": public_url,
            "message": "Chart published successfully!",
        }
    
        return [TextContent(type="text", text=json.dumps(result, indent=2))]
  • server.py:224-247 (registration)
    The MCP tool decorator and wrapper for publishing a chart.
    async def publish_chart(chart_id: str) -> str:
        """⚠️ DATAWRAPPER MCP TOOL ⚠️
        This is part of the Datawrapper MCP server integration.
    
        ---
    
        Publish a Datawrapper chart to make it publicly accessible.
        Returns the public URL of the published chart.
        IMPORTANT: Only use this tool when the user explicitly requests to publish the chart.
        Do not automatically publish charts after creation unless specifically asked.
    
        Args:
            chart_id: ID of the chart to publish
    
        Returns:
            Public URL of the published chart
        """
        try:
            arguments = cast(PublishChartArgs, {"chart_id": chart_id})
            result = await publish_chart_handler(arguments)
            return result[0].text
        except Exception as e:
            return f"Error publishing chart with ID '{chart_id}': {str(e)}"
  • Type definition for the arguments accepted by the publish_chart tool.
    class PublishChartArgs(TypedDict):
        """Arguments for publish_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