visualize
Fetch data and render it: a Vega-Lite chart when vega_lite is given, else an inline data grid. Use it instead of run_sql whenever the user asks for a chart, plot or graph of Mycorr data, or to see a Mycorr table's rows.
Pass exactly ONE source: table_id to show one RAW table, or sql for a query. To show a table's rows, pass table_id and NO sql: the view follows the CURRENT schema, so renames, new columns and edits show on refresh; a SELECT freezes it.
The SQL is DataFusion SQL under run_sql's rules (ids not names, double quotes, read-only). Alias every selected column to a readable name (SELECT "col-…" AS region, SUM("col-…") AS revenue … GROUP BY region); raw col-… labels are refused.
CHARTS: a Vega-Lite v6 unit or layer spec; there are no named chart types. Fields are your SELECT aliases; omit encoding types (the server fills them and lists each in spec_inferences). A bar chart: {"mark": "bar", "encoding": {"x": {"field": "region", "sort": null}, "y": {"field": "revenue"}}}; swap the mark for line/area/point/rect, add color for series, layer for overlays. Order categories with an outer ORDER BY in SQL. Aggregate to tens of marks. There are 8 series colours: fold a long tail into 'Other' in SQL (chart_hints warns past 8).
Relay truncated, join_fan_out and unlinked_joins warnings to the user.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "visualize"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | No | One read-only SQL statement, as for `run_sql`. Give exactly ONE of `sql` / `table_id`. | |
| title | No | Title shown above the chart or grid. | |
| max_rows | No | Maximum result rows: default 1000, cap 10000. Aggregate in SQL rather than raising it. | |
| table_id | No | Show this table as it is now, rebuilt from the CURRENT schema on every refresh; `_row_id` comes along. Pass NO `sql` with it. | |
| vega_lite | No | Vega-Lite v6 unit or layer spec (JSON object, ≤32KB). `facet`/`repeat`/`concat` are refused: use the `row`/`column` channels. Omit it for a plain data grid. Omit `data`: the result is injected as the only dataset, and `url`, `href` and nested `data`/`datasets` are refused. |