render_chart
Draw a Clarifo chart of a result you already fetched. Three outputs:
output="python"— ChatGPT and any host with a python / code tool. Returns a ready-to-run matplotlib script with every number, label, colour and the source line embedded server-side. Run it unchanged in your python tool; it ends withplt.show(), which makes the chart appear in your answer. Do not edit the numbers, do not save the figure to a file and never write a Markdown image link () — it renders as a broken image.output="image"(default) — a PNG image block, for hosts that show MCP images to the user inline (Claude). ChatGPT does NOT show MCP images to the user: useoutput="python"there.output="chart_spec"— the validated chart as JSON (periods, one series per metric with its unit, formula and figure basis, per-period citations, quality warnings, a text alternative). For a host that draws charts itself: plot these values exactly and print the warnings; it does not guarantee the host shows an interactive chart.
All three are built from one spec, so they always show the same metrics, periods and figures.
Call it only when a chart earns its place (a trend over 3+ periods, a
peer comparison over time, a ranking of 4+ names, a sensitivity grid);
a single figure or a two-row comparison needs a sentence or a table.
For several metrics of one company pass metrics (e.g.
["revenue", "operating_margin"]: revenue bars on the left axis, the
margin as a line on a labelled right axis); a peer comparison takes one
metric per call.
Only the named metrics are drawn — an unknown metric, or one the result
has no values for, is an error, never a substitute. Years with no value
for any charted metric are left off the axis; interior gaps stay gaps.
Pass the name of the tool you called and the same arguments you passed
it. The data is re-fetched and the chart is computed server-side from
Clarifo's stored data — never pass figures yourself, there is no
parameter for them. For get_stock_price pass the history-mode
arguments (days or a date range); without them that tool performs a
live latest-close web lookup.
Chartable tools: compare_companies (multi-year: one line per company
for metric, calendar-year aligned; single period: KPI table),
forecast_financials, get_company_financials, ownership (all
three modes), get_revenue_geography, get_stock_price (history
mode, i.e. with days or a date range), get_valuation_history,
screen_companies, screen_metric_trend,
screen_quality_growers, value_company.
Args:
source_tool: Name of the tool whose result to chart.
source_args: The arguments you passed to that tool, verbatim.
metric: Which metric to chart where the source carries several
(compare_companies: revenue (default), operating_margin,
net_income, gross_margin, free_cash_flow, ...).
get_company_financials: revenue_operating_income draws
revenue and operating income in one stacked bar per year (bar
total = revenue, base segment = operating income, margin row
underneath; a loss hangs below zero). Annual data only.
Single-company metrics: revenue, gross_profit,
operating_income, ebit, ebitda, net_income,
operating_cash_flow, capital_expenditures,
free_cash_flow, total_assets, total_equity,
eps_diluted (reported) and gross_margin,
operating_margin, ebit_margin, ebitda_margin,
net_margin, fcf_margin (computed: amount / revenue).
output: "python" (ChatGPT / code tools), "image" (PNG) or
"chart_spec" (JSON for a host that draws natively).
metrics: Several metrics in one chart (get_company_financials);
metric alone keeps working.
chart_type: "auto" (default: bars for up to 5 annual periods,
a line for longer series; an amount with a margin is a
bar_line_combo for up to 8 periods), "line", "bar",
"grouped_bar", "horizontal_bar" or "bar_line_combo"
(one company: amounts as bars, the % metric as a line on
its own right axis). Applies to get_company_financials and
compare_companies (combo: single company only).
Returns:
python: the script plus run instructions and the source line to
print under the chart. image: a one-line description plus the PNG.
chart_spec: the chart as data. All three carry quality_warnings
to print under the chart when present.
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": {
"source_tool": "<source_tool>"
},
"name": "render_chart"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| metric | No | ||
| output | No | image | |
| metrics | No | ||
| chart_type | No | auto | |
| source_args | No | ||
| source_tool | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||