Skip to main content
Glama

create_chart

Generate SVG, HTML, or PNG charts from structured data with 14 chart types including auto-detection. Ideal for visualizing in-memory lists or dicts.

Instructions

Generate an SVG, HTML, data-URL, or rasterized PNG chart from structured data. Supports 14 chart types (bar, column, line, scatter, bubble, pie, polar_area, radar, area, box, histogram, heatmap, gantt, combo) plus 'auto' which picks the best type automatically. Use this when you have data already in memory as a list or dict; for CSV input prefer chart_from_csv instead.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chart_typeYesThe type of chart to render. 'auto' inspects the data shape and picks the most appropriate type. Examples: 'bar' for horizontal category comparison, 'line' for time-series trends, 'pie' for part-of-whole proportions, 'scatter' for XY correlation, 'heatmap' for a 2-D color matrix.
dataYesChart data. For a single series pass a 1-D list of numbers, e.g. [10, 20, 15]. For multiple series pass a 2-D list where each inner list is one series, e.g. [[10, 20], [5, 30]]. Scatter/bubble charts expect [[x_values], [y_values]].
labelsNoCategory labels for the x-axis, one per data point. Example: ['Jan', 'Feb', 'Mar']. Omit for numeric or auto-indexed axes.
titleNoOptional chart title rendered above the plot area. Example: 'Monthly Revenue 2024'.
series_namesNoDisplay names for each data series, shown in the chart legend. Must match the number of series in data. Example: ['Revenue', 'Costs'].
widthNoChart canvas width in pixels. Default is 500. Increase for more detail or wider labels.
heightNoChart canvas height in pixels. Default is 500. Adjust to control aspect ratio.
themeNoVisual theme. Pass a preset name ('light', 'dark', 'high-contrast') or a palette name ('viridis', 'inferno', 'ocean', etc.) as a string, or a config object such as {'colors': 'viridis', 'background_color': '#1a1a2e'}. Use list_themes to see all available options.
output_formatNoFormat for the returned chart. 'svg' returns raw SVG markup (default, zero extra dependencies). 'html' wraps the SVG in a minimal HTML page. 'data_url' returns an SVG data URL suitable for use in an img src attribute. 'png' rasterizes the chart to a PNG image (requires charted[png]) and returns it as inline image content visible in chat UIs.svg
scaleNoResolution multiplier applied when output_format is 'png'. A value of 2 (default) doubles the pixel dimensions for high-DPI displays. Has no effect for SVG output.
save_pathNoOptional absolute or relative file path where the chart should also be saved on disk. The file extension should match output_format (e.g. 'chart.svg' or 'chart.png'). The tool still returns the chart content regardless.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed11 schema fields changedv1.0.1
    • changedInput schema / properties / chart_type / description
      Previous value: -"Chart type. 'auto' picks the best type from data shape."New value: +"The type of chart to render. 'auto' inspects the data shape and picks the most appropriate type. Examples: 'bar' for horizontal category comparison, 'line' for time-series trends, 'pie' for part-of-whole proportions, 'scatter' for XY correlation, 'heatmap' for a 2-D color matrix."
    • changedInput schema / properties / data / description
      Previous value: -"Chart data. 1D array for single series, 2D for multi-series."New value: +"Chart data. For a single series pass a 1-D list of numbers, e.g. [10, 20, 15]. For multiple series pass a 2-D list where each inner list is one series, e.g. [[10, 20], [5, 30]]. Scatter/bubble charts expect [[x_values], [y_values]]."
    • changedInput schema / properties / height / description
      Previous value: -"Chart height in pixels."New value: +"Chart canvas height in pixels. Default is 500. Adjust to control aspect ratio."
    • changedInput schema / properties / labels / description
      Previous value: -"X-axis category labels."New value: +"Category labels for the x-axis, one per data point. Example: ['Jan', 'Feb', 'Mar']. Omit for numeric or auto-indexed axes."
    • changedInput schema / properties / output_format / description
      Previous value: -"Output format. 'png' returns a rasterized PNG image (needs charted[png]); use it when the caller needs a picture rather than SVG markup."New value: +"Format for the returned chart. 'svg' returns raw SVG markup (default, zero extra dependencies). 'html' wraps the SVG in a minimal HTML page. 'data_url' returns an SVG data URL suitable for use in an img src attribute. 'png' rasterizes the chart to a PNG image (requires charted[png]) and returns it as inline image content visible in chat UIs."
    • changedInput schema / properties / save_path / description
      Previous value: -"Optional file path to save the chart."New value: +"Optional absolute or relative file path where the chart should also be saved on disk. The file extension should match output_format (e.g. 'chart.svg' or 'chart.png'). The tool still returns the chart content regardless."
    • changedInput schema / properties / scale / description
      Previous value: -"Resolution multiplier for 'png' output."New value: +"Resolution multiplier applied when output_format is 'png'. A value of 2 (default) doubles the pixel dimensions for high-DPI displays. Has no effect for SVG output."
    • changedInput schema / properties / series_names / description
      Previous value: -"Names for each data series (used in legend)."New value: +"Display names for each data series, shown in the chart legend. Must match the number of series in data. Example: ['Revenue', 'Costs']."
    • changedInput schema / properties / theme / description
      Previous value: -"Theme preset name or config object."New value: +"Visual theme. Pass a preset name ('light', 'dark', 'high-contrast') or a palette name ('viridis', 'inferno', 'ocean', etc.) as a string, or a config object such as {'colors': 'viridis', 'background_color': '#1a1a2e'}. Use list_themes to see all available options."
    • changedInput schema / properties / title / description
      Previous value: -"Chart title."New value: +"Optional chart title rendered above the plot area. Example: 'Monthly Revenue 2024'."
    • changedInput schema / properties / width / description
      Previous value: -"Chart width in pixels."New value: +"Chart canvas width in pixels. Default is 500. Increase for more detail or wider labels."
  2. First observedv1.0.0

TDQS

A4.4/5.0
Behavior3/5

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

No annotations provided, so description carries the burden. It explains output formats and optional file saving, but does not disclose behavioral traits like idempotency, safety, or side effects beyond creation. Lacks explicit statement that this is a read-only operation.

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

Conciseness5/5

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

Description is two sentences with a list of chart types. Front-loaded with main purpose, no wasted words. Efficient and structured well.

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

Completeness4/5

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

With 11 parameters fully described in schema and no output schema, the description covers main purpose and usage context. Does not explain return values or error handling, but for a chart generation tool the output is self-evident from parameters. Reasonably complete.

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?

Schema covers all 11 parameters with descriptions (100% coverage). Description adds value by explaining the 'auto' chart type behavior and the difference from chart_from_csv, but does not add meaning beyond schema for individual parameters. Baseline 3 + minor extra context.

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 generates charts from structured data and lists 14 supported chart types plus 'auto'. It distinguishes itself from sibling tool chart_from_csv by specifying when to use each.

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?

Explicit guidance: 'Use this when you have data already in memory as a list or dict; for CSV input prefer chart_from_csv instead.' This clearly tells the agent when to use and when not to use this tool.

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