> Documentation index for agents: https://docs.rocketride.ai/llms.txt

# tool_chartjs

A RocketRide tool node that asks the pipeline LLM to turn structured data into a ready-to-render Chart.js configuration for an agent response.

## About Chart.js

Chart.js is the chart configuration format produced by this node. The node requests a static JSON configuration and returns it in a `chartjs` fenced block for the RocketRide chat UI to render.

## What it does

Use this node when an agent needs a chart, graph, or visualization from supplied data rather than a hand-authored configuration. It is an agent tool with a required LLM connection, not a data-flow lane processor. The node validates the LLM's JSON response and wraps it in the rendering fence, so choose it over a generic LLM call when the response must be a Chart.js chart.

## Connections

| Connection | Required | Description |
|---|---|---|
| `llm` | yes | LLM used to generate Chart.js configurations from data. |

The node uses the first controller registered under the `llm` role. If no LLM is connected, `generate_chart` fails before it can generate a configuration.

## As a tool

The server name defaults to `chartjs`, registering `chartjs.generate_chart`.

| Function | Description |
|---|---|
| `chartjs.generate_chart` | Generates a static Chart.js JSON configuration from structured data and returns it as a `chartjs` fenced block. |

### `chartjs.generate_chart`

`data` is required and must be a non-empty object or array. Optional `chart_type` is one of `bar`, `line`, `pie`, `doughnut`, `radar`, `polarArea`, `scatter`, or `bubble`; `title` and `description` must be strings when supplied. The tool returns a string that must be placed verbatim in the answer—do not wrap it in another code fence. Invalid input, a missing LLM, an empty model response, or model output that is not JSON raises an error.

## Configuration

The only setting is the hidden server name. Most pipelines should retain the default.

### Server name

The server name determines the advertised namespace and defaults to `chartjs`. Change it only when multiple Chart.js nodes are attached to the same agent and their function names must be distinct; use the corresponding prefix when calling the tool.

## Notes

### Input shaping

List input is truncated to its first 200 entries before prompting the LLM. The serialized data is also limited to 20,000 characters; oversized serialized input is shortened before it reaches the model. Use summary-sized data when completeness matters, or pre-aggregate a larger export before calling the tool.

### Generated configuration

The internal prompt requires `type`, `data` with `labels` and `datasets`, and `options`, with responsiveness and aspect-ratio preservation enabled. It also prohibits JavaScript callbacks, so the output is static JSON rather than executable chart code.

## Upstream docs

- [Chart.js documentation](https://www.chartjs.org/docs/)

<!-- ROCKETRIDE:GENERATED:PARAMS START -->
<!-- Generated by nodes:docs-generate. Do not edit by hand. -->

## Schema

| Field | Type | Description | Default |
|---|---|---|---|
| `tool_chartjs.serverName` | `string` | **Server name**<br/>Namespace prefix for the tool: <serverName>.generate_chart | `"chartjs"` |

## Source

[<svg viewBox="0 0 16 16" width="15" height="15" fill="currentColor" aria-hidden="true" style="vertical-align:-0.15em;margin-right:0.35em"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"/></svg> View source](https://github.com/rocketride-org/rocketride-server/tree/develop/nodes/src/nodes/tool_chartjs)
<!-- ROCKETRIDE:GENERATED:PARAMS END -->
