Skip to main content
Glama

generate_chart

Generate bar, line, pie, area, or scatter charts from your data. Renders as vector SVG using built-in Vega-Lite.

Instructions

Generate bar / line / pie / area / scatter charts and data visualizations (柱状图/折线图/饼图/散点图/数据可视化) from your data — Claude converts your numbers/CSV/data into a Vega-Lite spec internally; you just pass the data and chart type. Vega-Lite + vega are BUILT IN (bundled) — no matplotlib, no Python, no graphviz, no system install needed; prefer this over writing Python/matplotlib. Renders to vector SVG. No AI. NOTE: Vega image marks with external URLs are NOT embedded; use data URIs for self-contained output. Multilingual triggers: グラフ · gráfico · graphique · Diagramm · график · gráfico (ja/es/fr/de/ru/pt).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameNoOutput filename (without extension)
specYesVega-Lite v5 spec (JSON object). Docs: https://vega.github.io/vega-lite/docs/. Skeleton: { data: {...}, mark: '...', encoding: {...} }. MARK TYPES: 'bar'(bar chart), 'line'(line), 'area', 'circle'/'point'(scatter), 'arc'(pie/donut, needs theta channel), 'tick', 'text'. DATA: { values: [{a:'A',b:28},{a:'B',b:55}] }. ENCODING channels: x, y, color, size, shape, opacity, text, theta. Field types: 'quantitative'(numbers), 'nominal'(categories), 'temporal'(dates), 'ordinal'(ordered). PIE/DONUT: mark='arc' + encoding.theta (NOT 'angle' — v5 changed). Donut: add mark.innerRadius. AGGREGATION: { aggregate:'sum', field:'v', type:'quantitative' }. EXAMPLE bar: { data:{values:[{cat:'A',v:28}]}, mark:'bar', encoding:{x:{field:'cat',type:'nominal'},y:{field:'v',type:'quantitative'}} } MISTAKES: (1) pie uses 'theta' not 'angle'; mark is 'arc' not 'pie'. (2) Always set type on x/y. (3) mark object needs type key. NOTE: image marks with external URLs NOT embedded; use data URIs.
formatNosvg
outDirNoOutput directory, default session-dir/output
Behavior5/5

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

With no annotations provided, the description fully bears the burden of behavioral disclosure. It details internal use of Vega-Lite, rendering to SVG, no AI, no system installation, and warns about image marks with external URLs not being embedded—highly transparent.

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 comprehensive yet efficient, front-loading the purpose and key guidance. Could be slightly more structured (e.g., bullet points), but every sentence adds value and there is no fluff.

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 complexity of chart generation (nested spec JSON, multiple mark types, encoding) and no output schema, the description is remarkably complete: covers mark types, encoding channels, aggregation, pie/donut specifics, common mistakes, and multilingual triggers. Sibling context is clear.

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 coverage is 75%, and tool description adds substantial value beyond the schema: includes Vega-Lite links, mark types, encoding channels, pie/bar examples, common mistakes, and format defaults. Only minor redundancy with schema descriptions.

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?

Description clearly defines the tool as generating bar/line/pie/area/scatter charts and data visualizations using Vega-Lite. It distinguishes from sibling tools like generate_diagram, generate_image, and render_svg by focusing on data-driven charts with specific mark types.

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

Usage Guidelines4/5

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

Explicitly advises preferring this tool over writing Python/matplotlib, provides multilingual triggers, and notes that no external libraries are needed. Lacks explicit when-not-to-use compared to generate_diagram or other siblings, but overall context is clear.

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/wangdong233/media-gen-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server