create_vega_chart
Create PNG or SVG charts from Vega-Lite specifications, save them to disk, and return the rendered image for reports, dashboards, or visual analysis.
Instructions
Create a chart from a Vega-Lite specification. Renders a Vega-Lite spec as PNG or SVG, saves to disk, and returns the image.
Example spec: {"mark": "bar", "data": {"values": [{"a": "A", "b": 28}, {"a": "B", "b": 55}]}, "encoding": {"x": {"field": "a", "type": "nominal"}, "y": {"field": "b", "type": "quantitative"}}}
Supports all Vega-Lite mark types: bar, line, area, point, circle, square, rect, arc, text, tick, rule, geoshape, trail, boxplot, errorbar, errorband. Supports layers, facets, concatenation, and repeats.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"spec": "<spec>"
},
"name": "create_vega_chart"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| spec | Yes | Vega-Lite specification as a JSON object. Must include "mark" and "encoding" for simple charts, or use "layer"/"hconcat"/"vconcat" for compositions. | |
| width | No | Override chart width in pixels (default: from spec or 400) | |
| height | No | Override chart height in pixels (default: from spec or 300) | |
| autoOpen | No | Open chart in default viewer (default true) | |
| background | No | Override background color (default: from spec or "white") | |
| outputPath | No | Custom file path to save the chart | |
| outputFormat | No | Output format: png (default) or svg |