Skip to main content
Glama

generate_chart

Run a read-only SQL query and render the results as a bar, line, or scatter chart image. Visualize data with optional series splitting for multi-trace comparisons.

Instructions

Run a read-only SQL query and render the result as a chart image (bar, line, or scatter). Subject to the same read-only safety guardrails as run_sql_query.

Returns an inline chart image on success. On failure (bad SQL, missing column, empty result, oversized render), returns an error dict instead -- check for an "error" key if the result isn't an image. (No static return-type annotation here: the mcp SDK's output-schema generation can't handle Image inside a Union type.)

Args: sql: A single read-only SQL statement producing the data to chart. Aggregate/group the data yourself for cleaner charts (e.g. GROUP BY category). chart_type: "bar", "line", or "scatter". x_column: Column name (from the query result) for the x-axis. y_column: Column name (from the query result) for the y-axis. series_column: Optional column to split into multiple series/ traces (e.g. one line per region). title: Optional chart title. Defaults to "{y_column} by {x_column}".

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYes
titleNo
x_columnYes
y_columnYes
chart_typeYes
series_columnNo
Behavior5/5

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

No annotations are present, so the description fully carries the burden. It discloses read-only behavior, success returns an inline image, failure returns an error dict (with specific failure cases like bad SQL, missing column, empty result, oversized render), and explains the lack of a static return-type annotation due to SDK limitations. This is thorough and adds significant behavioral context.

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?

The description is well-structured: an overview sentence, a return/error contract, and a clear argument list. While it is long, the length is justified by the number of parameters and the need to explain error handling.

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?

The description covers input semantics, parameter defaults, failure modes, and return format. Since there is no output schema, it appropriately explains what the caller should expect on both success and failure. This is complete for a chart-generation tool with 6 parameters.

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

Parameters5/5

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

With schema description coverage at 0%, the description fully compensates by explaining each of the 6 parameters: sql with aggregation advice, chart_type enum, x_column, y_column, optional series_column, and title default. This adds meaning far beyond the bare parameter names in the schema.

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 runs a read-only SQL query and renders the result as a chart image, specifying chart types (bar, line, scatter). It distinguishes itself from sibling tools like run_sql_query by focusing on chart rendering rather than raw query results.

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?

The description gives useful usage context, such as read-only safety guardrails and advising the caller to aggregate/group data for cleaner charts. However, it does not explicitly state when to prefer this over alternatives like run_sql_query for non-chart needs, so it lacks an explicit exclusion or alternative recommendation.

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/MostafaAI10/OmniData-MCP'

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