@outsidedata/dolex 0.1.13 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/analysis/rules.d.ts.map +1 -1
- package/dist/src/analysis/rules.js +8 -2
- package/dist/src/analysis/rules.js.map +1 -1
- package/dist/src/connectors/csv.d.ts.map +1 -1
- package/dist/src/connectors/csv.js +31 -1
- package/dist/src/connectors/csv.js.map +1 -1
- package/dist/src/connectors/dsl-compiler.d.ts +4 -0
- package/dist/src/connectors/dsl-compiler.d.ts.map +1 -1
- package/dist/src/connectors/dsl-compiler.js +51 -18
- package/dist/src/connectors/dsl-compiler.js.map +1 -1
- package/dist/src/connectors/dsl-validator.js +6 -1
- package/dist/src/connectors/dsl-validator.js.map +1 -1
- package/dist/src/connectors/js-aggregation.d.ts.map +1 -1
- package/dist/src/connectors/js-aggregation.js +18 -12
- package/dist/src/connectors/js-aggregation.js.map +1 -1
- package/dist/src/mcp/index.js +62 -28
- package/dist/src/mcp/index.js.map +1 -1
- package/dist/src/mcp/spec-store.d.ts +2 -1
- package/dist/src/mcp/spec-store.d.ts.map +1 -1
- package/dist/src/mcp/spec-store.js +4 -2
- package/dist/src/mcp/spec-store.js.map +1 -1
- package/dist/src/mcp/tools/dsl-schemas.d.ts +52 -51
- package/dist/src/mcp/tools/dsl-schemas.d.ts.map +1 -1
- package/dist/src/mcp/tools/dsl-schemas.js +1 -1
- package/dist/src/mcp/tools/dsl-schemas.js.map +1 -1
- package/dist/src/mcp/tools/list-patterns.js +2 -2
- package/dist/src/mcp/tools/list-patterns.js.map +1 -1
- package/dist/src/mcp/tools/query-source.d.ts +16 -16
- package/dist/src/mcp/tools/refine.d.ts +124 -15
- package/dist/src/mcp/tools/refine.d.ts.map +1 -1
- package/dist/src/mcp/tools/refine.js +335 -253
- package/dist/src/mcp/tools/refine.js.map +1 -1
- package/dist/src/mcp/tools/shared.d.ts +15 -2
- package/dist/src/mcp/tools/shared.d.ts.map +1 -1
- package/dist/src/mcp/tools/shared.js +64 -6
- package/dist/src/mcp/tools/shared.js.map +1 -1
- package/dist/src/mcp/tools/visualize-from-source.d.ts +52 -76
- package/dist/src/mcp/tools/visualize-from-source.d.ts.map +1 -1
- package/dist/src/mcp/tools/visualize-from-source.js +20 -5
- package/dist/src/mcp/tools/visualize-from-source.js.map +1 -1
- package/dist/src/mcp/tools/visualize.d.ts +45 -100
- package/dist/src/mcp/tools/visualize.d.ts.map +1 -1
- package/dist/src/mcp/tools/visualize.js +19 -19
- package/dist/src/mcp/tools/visualize.js.map +1 -1
- package/dist/src/patterns/definitions/comparison/grouped-bar.js +5 -5
- package/dist/src/patterns/definitions/comparison/grouped-bar.js.map +1 -1
- package/dist/src/patterns/definitions/composition/waffle.d.ts.map +1 -1
- package/dist/src/patterns/definitions/composition/waffle.js +17 -3
- package/dist/src/patterns/definitions/composition/waffle.js.map +1 -1
- package/dist/src/patterns/definitions/distribution/strip-plot.d.ts.map +1 -1
- package/dist/src/patterns/definitions/distribution/strip-plot.js +12 -3
- package/dist/src/patterns/definitions/distribution/strip-plot.js.map +1 -1
- package/dist/src/patterns/definitions/time/sparkline-grid.js +2 -2
- package/dist/src/patterns/definitions/time/sparkline-grid.js.map +1 -1
- package/dist/src/patterns/selector.d.ts.map +1 -1
- package/dist/src/patterns/selector.js +46 -1
- package/dist/src/patterns/selector.js.map +1 -1
- package/dist/src/renderers/d3/comparison/bar.d.ts.map +1 -1
- package/dist/src/renderers/d3/comparison/bar.js +24 -1
- package/dist/src/renderers/d3/comparison/bar.js.map +1 -1
- package/dist/src/renderers/d3/comparison/grouped-bar.d.ts.map +1 -1
- package/dist/src/renderers/d3/comparison/grouped-bar.js +9 -4
- package/dist/src/renderers/d3/comparison/grouped-bar.js.map +1 -1
- package/dist/src/renderers/d3/composition/donut.d.ts.map +1 -1
- package/dist/src/renderers/d3/composition/donut.js +12 -0
- package/dist/src/renderers/d3/composition/donut.js.map +1 -1
- package/dist/src/renderers/d3/composition/stacked-bar.d.ts.map +1 -1
- package/dist/src/renderers/d3/composition/stacked-bar.js +4 -0
- package/dist/src/renderers/d3/composition/stacked-bar.js.map +1 -1
- package/dist/src/renderers/d3/composition/treemap.js +2 -1
- package/dist/src/renderers/d3/composition/treemap.js.map +1 -1
- package/dist/src/renderers/d3/distribution/beeswarm.d.ts.map +1 -1
- package/dist/src/renderers/d3/distribution/beeswarm.js +8 -0
- package/dist/src/renderers/d3/distribution/beeswarm.js.map +1 -1
- package/dist/src/renderers/d3/distribution/histogram.js +36 -2
- package/dist/src/renderers/d3/distribution/histogram.js.map +1 -1
- package/dist/src/renderers/d3/flow/funnel.d.ts.map +1 -1
- package/dist/src/renderers/d3/flow/funnel.js +4 -0
- package/dist/src/renderers/d3/flow/funnel.js.map +1 -1
- package/dist/src/renderers/d3/flow/sankey-layout.js +20 -3
- package/dist/src/renderers/d3/flow/sankey-layout.js.map +1 -1
- package/dist/src/renderers/d3/heatmap.d.ts.map +1 -1
- package/dist/src/renderers/d3/heatmap.js +18 -3
- package/dist/src/renderers/d3/heatmap.js.map +1 -1
- package/dist/src/renderers/d3/radar.d.ts.map +1 -1
- package/dist/src/renderers/d3/radar.js +3 -1
- package/dist/src/renderers/d3/radar.js.map +1 -1
- package/dist/src/renderers/d3/relationship.d.ts.map +1 -1
- package/dist/src/renderers/d3/relationship.js +29 -7
- package/dist/src/renderers/d3/relationship.js.map +1 -1
- package/dist/src/renderers/d3/shared.js +7 -7
- package/dist/src/renderers/d3/shared.js.map +1 -1
- package/dist/src/renderers/d3/time/area.js +21 -7
- package/dist/src/renderers/d3/time/area.js.map +1 -1
- package/dist/src/renderers/d3/time/calendar-heatmap.js +6 -0
- package/dist/src/renderers/d3/time/calendar-heatmap.js.map +1 -1
- package/dist/src/renderers/d3/time/horizon-chart.d.ts.map +1 -1
- package/dist/src/renderers/d3/time/horizon-chart.js +10 -0
- package/dist/src/renderers/d3/time/horizon-chart.js.map +1 -1
- package/dist/src/renderers/d3/time/line.d.ts.map +1 -1
- package/dist/src/renderers/d3/time/line.js +27 -7
- package/dist/src/renderers/d3/time/line.js.map +1 -1
- package/dist/src/renderers/d3/time/small-multiples.js +8 -0
- package/dist/src/renderers/d3/time/small-multiples.js.map +1 -1
- package/dist/src/renderers/d3/time/sparkline-grid.d.ts.map +1 -1
- package/dist/src/renderers/d3/time/sparkline-grid.js +5 -2
- package/dist/src/renderers/d3/time/sparkline-grid.js.map +1 -1
- package/dist/src/renderers/d3/time/stream-graph.js +6 -0
- package/dist/src/renderers/d3/time/stream-graph.js.map +1 -1
- package/dist/src/renderers/html/_generated/bundles.d.ts +39 -39
- package/dist/src/renderers/html/_generated/bundles.d.ts.map +1 -1
- package/dist/src/renderers/html/_generated/bundles.js +39 -39
- package/dist/src/renderers/html/_generated/bundles.js.map +1 -1
- package/dist/src/renderers/html/template.js +2 -2
- package/dist/src/renderers/html/template.js.map +1 -1
- package/dist/src/types.d.ts +30 -2
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js.map +1 -1
- package/package.json +2 -1
- package/src/analysis/rules.ts +10 -2
- package/src/connectors/csv.ts +31 -1
- package/src/connectors/dsl-compiler.ts +56 -20
- package/src/connectors/dsl-validator.ts +6 -1
- package/src/connectors/js-aggregation.ts +16 -11
- package/src/mcp/index.ts +62 -28
- package/src/mcp/spec-store.ts +5 -1
- package/src/mcp/tools/dsl-schemas.ts +1 -1
- package/src/mcp/tools/list-patterns.ts +2 -2
- package/src/mcp/tools/refine.ts +333 -258
- package/src/mcp/tools/shared.ts +70 -7
- package/src/mcp/tools/visualize-from-source.ts +20 -5
- package/src/mcp/tools/visualize.ts +22 -22
- package/src/patterns/definitions/comparison/grouped-bar.ts +5 -5
- package/src/patterns/definitions/composition/waffle.ts +17 -3
- package/src/patterns/definitions/distribution/strip-plot.ts +12 -3
- package/src/patterns/definitions/time/sparkline-grid.ts +2 -2
- package/src/patterns/selector.ts +47 -1
- package/src/renderers/d3/comparison/bar.ts +24 -1
- package/src/renderers/d3/comparison/grouped-bar.ts +9 -4
- package/src/renderers/d3/composition/donut.ts +14 -0
- package/src/renderers/d3/composition/stacked-bar.ts +5 -0
- package/src/renderers/d3/composition/treemap.ts +2 -1
- package/src/renderers/d3/distribution/beeswarm.ts +12 -0
- package/src/renderers/d3/distribution/histogram.ts +44 -2
- package/src/renderers/d3/flow/funnel.ts +8 -0
- package/src/renderers/d3/flow/sankey-layout.ts +23 -3
- package/src/renderers/d3/heatmap.ts +20 -2
- package/src/renderers/d3/radar.ts +4 -1
- package/src/renderers/d3/relationship.ts +31 -6
- package/src/renderers/d3/shared.ts +7 -7
- package/src/renderers/d3/time/area.ts +22 -7
- package/src/renderers/d3/time/calendar-heatmap.ts +5 -0
- package/src/renderers/d3/time/horizon-chart.ts +11 -0
- package/src/renderers/d3/time/line.ts +24 -9
- package/src/renderers/d3/time/small-multiples.ts +6 -0
- package/src/renderers/d3/time/sparkline-grid.ts +5 -2
- package/src/renderers/d3/time/stream-graph.ts +5 -0
- package/src/renderers/html/_generated/bundles.ts +39 -39
- package/src/renderers/html/template.ts +2 -2
- package/src/types.ts +18 -2
package/src/mcp/index.ts
CHANGED
|
@@ -61,9 +61,10 @@ import { screenshotInputSchema, handleScreenshot, closeBrowser } from './tools/s
|
|
|
61
61
|
import { specStore } from './spec-store.js';
|
|
62
62
|
import { registerPrompts } from './prompts.js';
|
|
63
63
|
|
|
64
|
-
import { mkdirSync } from 'fs';
|
|
64
|
+
import { mkdirSync, readFileSync } from 'fs';
|
|
65
65
|
import { join } from 'path';
|
|
66
66
|
import { homedir } from 'os';
|
|
67
|
+
import { fileURLToPath } from 'url';
|
|
67
68
|
|
|
68
69
|
// Pattern library imports
|
|
69
70
|
import { registry } from '../patterns/registry.js';
|
|
@@ -81,29 +82,62 @@ const sourceManager = new SourceManager(join(dolexDir, 'sources.json'));
|
|
|
81
82
|
|
|
82
83
|
const serverStartTime = Date.now();
|
|
83
84
|
|
|
85
|
+
const __dirname = join(fileURLToPath(import.meta.url), '..');
|
|
86
|
+
const iconPath = join(__dirname, '..', '..', 'assets', 'icon.svg');
|
|
87
|
+
let serverIcons: Array<{ src: string; mimeType: string }> | undefined;
|
|
88
|
+
try {
|
|
89
|
+
const svgData = readFileSync(iconPath);
|
|
90
|
+
serverIcons = [{ src: `data:image/svg+xml;base64,${svgData.toString('base64')}`, mimeType: 'image/svg+xml' }];
|
|
91
|
+
} catch {}
|
|
92
|
+
|
|
84
93
|
// ─── CREATE SERVER ──────────────────────────────────────────────────────────
|
|
85
94
|
|
|
86
95
|
const server = new McpServer(
|
|
87
96
|
{
|
|
88
97
|
name: 'dolex',
|
|
89
98
|
version: '0.1.13',
|
|
99
|
+
...(serverIcons && { icons: serverIcons }),
|
|
90
100
|
},
|
|
91
101
|
{
|
|
92
102
|
instructions: [
|
|
93
|
-
'
|
|
103
|
+
'Dolex — Data visualization with 43 chart types.',
|
|
104
|
+
'',
|
|
105
|
+
'WORKFLOW:',
|
|
106
|
+
'• Got a file path? → add_source(path) immediately, don\'t verify — this server runs locally on the user\'s machine',
|
|
107
|
+
'• Got inline data? → visualize(data, intent) directly',
|
|
108
|
+
'• Need to explore? → add_source → analyze_source → visualize_from_source per step',
|
|
109
|
+
'• Need a dashboard? → add_source → create_dashboard with views array',
|
|
110
|
+
'',
|
|
111
|
+
'CONTINUATION (source already connected):',
|
|
112
|
+
'• Chart from source → visualize_from_source(sourceId, table, query, intent)',
|
|
113
|
+
'• Want to SEE rows (answer a question, validate data, show a table)? → query_source',
|
|
114
|
+
'• Want to CHART rows you already queried? → visualize(resultId=...) to reuse cached data',
|
|
115
|
+
'• Want a table view? → query_source for raw data, or visualize with includeDataTable=true for a formatted table with chart',
|
|
116
|
+
'• Tweak a chart → refine_visualization(specId, ...) — always use the MOST RECENT specId',
|
|
117
|
+
'• Tweak a dashboard → refine_dashboard(currentSpec, refinement)',
|
|
118
|
+
'• specId expired? → re-run the original visualize/visualize_from_source call, then continue refining from the new specId',
|
|
119
|
+
'',
|
|
120
|
+
'TOOL GUIDE:',
|
|
121
|
+
'• add_source: Connect CSV/SQLite/Postgres/MySQL. Returns sourceId.',
|
|
122
|
+
'• describe_source: See schema, stats, samples. Use detail="compact" for large schemas.',
|
|
123
|
+
'• analyze_source: Auto-generate analysis plan with ready DSL queries. Execute each step with visualize_from_source; present results one at a time.',
|
|
124
|
+
'• query_source: Run DSL query, get rows. Returns resultId for visualize().',
|
|
125
|
+
'• visualize: Chart from inline data OR resultId from query_source. Auto-selects best pattern. Set title/subtitle here to avoid a refine round-trip.',
|
|
126
|
+
'• visualize_from_source: Chart from source + DSL query. Same as visualize but queries server-side — saves tokens.',
|
|
127
|
+
'• refine_visualization: Tweak a chart — sort, limit, filter, palette, highlight, flip, title, format. Each call returns a new specId.',
|
|
128
|
+
'• create_dashboard: Multi-chart layout from source with per-view queries.',
|
|
129
|
+
'• refine_dashboard: Iterate dashboard — add/remove views, filters, layout, theme.',
|
|
130
|
+
'• list_patterns: Browse available chart types. Only needed when the user asks what charts are available or you need a pattern ID.',
|
|
94
131
|
'',
|
|
95
|
-
'
|
|
96
|
-
'Do not check /mnt/user-data/uploads. Do not use the view tool. Do not verify the path. Do not hesitate.',
|
|
97
|
-
'Just call add_source. This MCP server runs locally on the user\'s machine.',
|
|
132
|
+
'Utility tools: list_sources, remove_source, server_status (inspect cached data), clear_cache, report_bug (generate GitHub issue), export_html (get chart HTML by specId), screenshot (render to PNG).',
|
|
98
133
|
'',
|
|
99
|
-
'
|
|
100
|
-
'
|
|
134
|
+
'COLOR: Set palette (categorical/blue/warm/blueRed/etc.) and/or highlight specific values. Use colorField to control which column drives color.',
|
|
135
|
+
'PATTERNS: 43 types auto-selected by data shape + intent. When user names a specific chart type, pass pattern="<id>" to force it. Use list_patterns to browse.',
|
|
101
136
|
'',
|
|
102
|
-
'If
|
|
103
|
-
'If add_source returns an error, THEN discuss it. Never pre-emptively refuse.',
|
|
137
|
+
'ERRORS: If a DSL query fails with field name suggestions, retry with the corrected name. If specId is expired, re-run visualize.',
|
|
104
138
|
'',
|
|
105
|
-
'Dolex
|
|
106
|
-
'
|
|
139
|
+
'DON\'T use Dolex for: simple arithmetic, explanations of chart types, non-data questions, or file format conversions (CSV export, PowerPoint, etc.).',
|
|
140
|
+
'DO use Dolex when the user asks "what chart should I use" — run visualize and let the pattern selector recommend.',
|
|
107
141
|
].join('\n'),
|
|
108
142
|
},
|
|
109
143
|
);
|
|
@@ -138,7 +172,7 @@ registerAppTool(
|
|
|
138
172
|
'visualize',
|
|
139
173
|
{
|
|
140
174
|
title: 'Visualize Data',
|
|
141
|
-
description: '
|
|
175
|
+
description: 'Chart inline data or cached query results. Pass data array + intent, OR resultId from query_source.\n\nWhen to use: You have data in the conversation (pasted, generated, or from query_source resultId). Use visualize_from_source instead when data lives in a connected source — saves tokens.\n\nKey params: pattern (force a specific chart type), palette, highlight, colorField, title, subtitle.\n\nResponse: specId (use in refine calls — always use the most recent one), recommended pattern + reasoning, alternatives, data shape summary. Chart HTML in structuredContent. If the response includes notes, present each note to the user — they explain decisions the system made automatically.',
|
|
142
176
|
inputSchema: visualizeInputSchema.shape,
|
|
143
177
|
_meta: {
|
|
144
178
|
ui: {
|
|
@@ -158,7 +192,7 @@ registerAppTool(
|
|
|
158
192
|
'visualize_from_source',
|
|
159
193
|
{
|
|
160
194
|
title: 'Visualize from Data Source',
|
|
161
|
-
description: '
|
|
195
|
+
description: 'Chart data from a connected source. Queries server-side — no data in the context window.\n\nWhen to use: Source already connected via add_source. Prefer this over query_source + visualize for one-step charting.\n\nKey params: sourceId, table, query (DSL: { select, groupBy, filter, orderBy, limit }), intent, pattern, palette, highlight, colorField.\n\nResponse: Same as visualize — specId, pattern, alternatives, chart HTML.',
|
|
162
196
|
inputSchema: visualizeFromSourceInputSchema.shape,
|
|
163
197
|
_meta: {
|
|
164
198
|
ui: {
|
|
@@ -176,7 +210,7 @@ server.registerTool(
|
|
|
176
210
|
'list_patterns',
|
|
177
211
|
{
|
|
178
212
|
title: 'List Visualization Patterns',
|
|
179
|
-
description: 'Browse all
|
|
213
|
+
description: 'Browse all 43 chart types with data requirements, capabilities, and examples. Returns per-pattern color encoding support and config options.\n\nWhen to use: User asks what charts are available, or you need to look up a pattern ID for the pattern parameter.',
|
|
180
214
|
},
|
|
181
215
|
handleListPatterns(() => registry.getAll()),
|
|
182
216
|
);
|
|
@@ -186,7 +220,7 @@ registerAppTool(
|
|
|
186
220
|
'refine_visualization',
|
|
187
221
|
{
|
|
188
222
|
title: 'Refine Visualization',
|
|
189
|
-
description: 'Tweak a
|
|
223
|
+
description: 'Tweak a chart using structured parameters. Pass specId from a previous visualize or refine call.\n\nAlways use the most recent specId — each refine returns a new one that includes all previous changes. If the response includes notes, present each note to the user.\n\nParameters (all optional except specId):\n• sort: { direction: "asc"|"desc", field?: "column_name" } — if field omitted, sorts by primary measure axis\n• limit: number (top N rows)\n• filter: [{ field: "col", op: "in"|"not_in"|"gt"|"gte"|"lt"|"lte", values: [...] }] — pass [] to clear filters\n• flip: true (swap axes — Cartesian charts only)\n• title / subtitle / xLabel / yLabel: strings\n• palette: "categorical"|"blue"|"warm"|"blueRed"|"green"|"purple"|"greenPurple"|"tealOrange"|"redGreen"|"traffic-light"|"profit-loss"|"temperature"\n• highlight: { values: ["val1", "val2"], color?: "css-color", mutedOpacity?: 0.3 } — pass null to clear\n• colorField: "column_name" (which field drives color)\n• flowColorBy: "source"|"target" (alluvial charts only)\n• format: "percent"|"dollar"|"integer"|"decimal"|"compact"\n• switchPattern: "pattern-id" (switch chart type)\n\nCompound chart params: removeTable, layout ("rows"|"columns"), hideColumns (array of column names to hide from data table).\n\nReturns new specId + changes applied + available alternatives.',
|
|
190
224
|
inputSchema: refineInputSchema.shape,
|
|
191
225
|
_meta: {
|
|
192
226
|
ui: {
|
|
@@ -205,7 +239,7 @@ server.registerTool(
|
|
|
205
239
|
'add_source',
|
|
206
240
|
{
|
|
207
241
|
title: 'Add Data Source',
|
|
208
|
-
description: '
|
|
242
|
+
description: 'Connect a data source. Call this immediately with any user-provided path — this server runs locally on the user\'s machine.\n\nSupports CSV files/directories, SQLite, PostgreSQL, MySQL. Sources persist across restarts.\n\nKey params: detail="compact" for just column names/types (saves tokens), detail="full" for stats + samples (default).\n\nReturns sourceId (use in all subsequent source operations).',
|
|
209
243
|
inputSchema: addSourceInputSchema,
|
|
210
244
|
},
|
|
211
245
|
handleAddSource({ sourceManager }),
|
|
@@ -215,7 +249,7 @@ server.registerTool(
|
|
|
215
249
|
'list_sources',
|
|
216
250
|
{
|
|
217
251
|
title: 'List Data Sources',
|
|
218
|
-
description: 'List all connected data sources with
|
|
252
|
+
description: 'List all connected data sources with IDs, types, and table counts.',
|
|
219
253
|
},
|
|
220
254
|
handleListSources({ sourceManager }),
|
|
221
255
|
);
|
|
@@ -224,7 +258,7 @@ server.registerTool(
|
|
|
224
258
|
'remove_source',
|
|
225
259
|
{
|
|
226
260
|
title: 'Remove Data Source',
|
|
227
|
-
description: 'Disconnect and remove a data source by
|
|
261
|
+
description: 'Disconnect and remove a data source by ID.',
|
|
228
262
|
inputSchema: removeSourceInputSchema,
|
|
229
263
|
},
|
|
230
264
|
handleRemoveSource({ sourceManager }),
|
|
@@ -234,7 +268,7 @@ server.registerTool(
|
|
|
234
268
|
'describe_source',
|
|
235
269
|
{
|
|
236
270
|
title: 'Describe Data Source',
|
|
237
|
-
description: '
|
|
271
|
+
description: 'Examine column profiles for a connected source. Use to re-inspect data mid-conversation.\n\nKey params: detail="compact" for column names/types only (saves tokens), detail="full" for stats + samples (default).',
|
|
238
272
|
inputSchema: describeSourceInputSchema,
|
|
239
273
|
},
|
|
240
274
|
handleDescribeSource({ sourceManager }),
|
|
@@ -244,7 +278,7 @@ server.registerTool(
|
|
|
244
278
|
'analyze_source',
|
|
245
279
|
{
|
|
246
280
|
title: 'Analyze Data Source',
|
|
247
|
-
description: '
|
|
281
|
+
description: 'Auto-generate a structured analysis plan with ready-to-execute DSL queries. Returns 4-6 analysis steps covering trends, comparisons, distributions, and relationships.\n\nWhen to use: After add_source, to get an automatic data exploration plan. Execute each step with visualize_from_source and present results one at a time.',
|
|
248
282
|
inputSchema: analyzeSourceInputSchema.shape,
|
|
249
283
|
},
|
|
250
284
|
handleAnalyzeSource({ sourceManager }),
|
|
@@ -254,7 +288,7 @@ server.registerTool(
|
|
|
254
288
|
'query_source',
|
|
255
289
|
{
|
|
256
290
|
title: 'Query Data Source',
|
|
257
|
-
description: 'Run a
|
|
291
|
+
description: 'Run a DSL query and get tabular results. Returns resultId — pass to visualize(resultId=...) to chart the same data without re-sending rows.\n\nWhen to use: Need to see raw data, answer a data question, or validate before charting. For one-step charting, use visualize_from_source instead.\n\nKey params: sourceId, table, query (DSL: { select, groupBy, filter, join, orderBy, limit }).',
|
|
258
292
|
inputSchema: querySourceInputSchema,
|
|
259
293
|
},
|
|
260
294
|
handleQuerySource({ sourceManager }),
|
|
@@ -266,7 +300,7 @@ registerAppTool(
|
|
|
266
300
|
'create_dashboard',
|
|
267
301
|
{
|
|
268
302
|
title: 'Create Dashboard',
|
|
269
|
-
description: 'Create a multi-view dashboard from a data source. Each view has its own DSL query and intent
|
|
303
|
+
description: 'Create a multi-view dashboard from a data source. Each view has its own DSL query and intent.\n\nKey params: sourceId, table, views (array with id, title, intent, query per view), layout, filters.\n\nReturns DashboardSpec (pass to refine_dashboard for iterations) + rendered HTML.',
|
|
270
304
|
inputSchema: createDashboardInputSchema.shape,
|
|
271
305
|
_meta: {
|
|
272
306
|
ui: {
|
|
@@ -285,7 +319,7 @@ registerAppTool(
|
|
|
285
319
|
'refine_dashboard',
|
|
286
320
|
{
|
|
287
321
|
title: 'Refine Dashboard',
|
|
288
|
-
description: 'Iterate on a dashboard
|
|
322
|
+
description: 'Iterate on a dashboard using natural language. Pass currentSpec from create_dashboard or previous refine.\n\nUnlike refine_visualization which uses structured parameters, this tool accepts natural language descriptions of changes.\n\nExamples: "add a chart showing revenue by month", "remove the bar chart", "3 columns", "add region filter", "dark mode".\n\nReturns updated DashboardSpec + rendered HTML.',
|
|
289
323
|
inputSchema: refineDashboardInputSchema.shape,
|
|
290
324
|
_meta: {
|
|
291
325
|
ui: {
|
|
@@ -306,7 +340,7 @@ server.registerTool(
|
|
|
306
340
|
'server_status',
|
|
307
341
|
{
|
|
308
342
|
title: 'Server Status',
|
|
309
|
-
description: '
|
|
343
|
+
description: 'Inspect cached data in server memory: specs with row counts, query results, connected sources, uptime. Use before clear_cache.',
|
|
310
344
|
},
|
|
311
345
|
handleServerStatus(privacyDeps),
|
|
312
346
|
);
|
|
@@ -315,7 +349,7 @@ server.registerTool(
|
|
|
315
349
|
'clear_cache',
|
|
316
350
|
{
|
|
317
351
|
title: 'Clear Cache',
|
|
318
|
-
description: '
|
|
352
|
+
description: 'Clear cached data from memory. Scope: "all" (specs + results), "specs" (visualization specs), "results" (query cache). Use after working with sensitive data.',
|
|
319
353
|
inputSchema: clearCacheInputSchema,
|
|
320
354
|
},
|
|
321
355
|
handleClearCache(privacyDeps),
|
|
@@ -325,7 +359,7 @@ server.registerTool(
|
|
|
325
359
|
'report_bug',
|
|
326
360
|
{
|
|
327
361
|
title: 'Report Bug',
|
|
328
|
-
description: 'Generate a sanitized bug report for
|
|
362
|
+
description: 'Generate a sanitized bug report for GitHub issues. Includes environment info and recent operations — never includes data values or file paths.',
|
|
329
363
|
inputSchema: bugReportInputSchema.shape,
|
|
330
364
|
},
|
|
331
365
|
handleReportBug({ sourceManager, serverStartTime }),
|
|
@@ -335,7 +369,7 @@ server.registerTool(
|
|
|
335
369
|
'export_html',
|
|
336
370
|
{
|
|
337
371
|
title: 'Export Chart HTML',
|
|
338
|
-
description: '
|
|
372
|
+
description: 'Get the full self-contained HTML for a visualization by specId. Suitable for saving to file or opening in a browser.',
|
|
339
373
|
inputSchema: exportHtmlInputSchema.shape,
|
|
340
374
|
},
|
|
341
375
|
handleExportHtml(),
|
|
@@ -345,7 +379,7 @@ server.registerTool(
|
|
|
345
379
|
'screenshot',
|
|
346
380
|
{
|
|
347
381
|
title: 'Screenshot Visualization',
|
|
348
|
-
description: 'Render a visualization to
|
|
382
|
+
description: 'Render a visualization to PNG via headless Chromium. Returns base64-encoded image. Requires Playwright: npm install playwright && npx playwright install chromium.',
|
|
349
383
|
inputSchema: screenshotInputSchema.shape,
|
|
350
384
|
},
|
|
351
385
|
handleScreenshot(),
|
package/src/mcp/spec-store.ts
CHANGED
|
@@ -18,6 +18,7 @@ export interface StoredSpec {
|
|
|
18
18
|
spec: VisualizationSpec | CompoundVisualizationSpec;
|
|
19
19
|
columns: DataColumn[];
|
|
20
20
|
alternatives: Map<string, VisualizationSpec>;
|
|
21
|
+
originalData?: Record<string, any>[];
|
|
21
22
|
createdAt: number;
|
|
22
23
|
}
|
|
23
24
|
|
|
@@ -47,6 +48,7 @@ export class SpecStore {
|
|
|
47
48
|
spec: VisualizationSpec | CompoundVisualizationSpec,
|
|
48
49
|
columns: DataColumn[],
|
|
49
50
|
alternatives: Map<string, VisualizationSpec> = new Map(),
|
|
51
|
+
originalData?: Record<string, any>[],
|
|
50
52
|
): string {
|
|
51
53
|
this.purgeExpired();
|
|
52
54
|
|
|
@@ -60,6 +62,7 @@ export class SpecStore {
|
|
|
60
62
|
spec,
|
|
61
63
|
columns,
|
|
62
64
|
alternatives,
|
|
65
|
+
originalData,
|
|
63
66
|
createdAt: Date.now(),
|
|
64
67
|
});
|
|
65
68
|
return id;
|
|
@@ -82,7 +85,8 @@ export class SpecStore {
|
|
|
82
85
|
const existing = this.store.get(specId);
|
|
83
86
|
const columns = existing?.columns ?? [];
|
|
84
87
|
const alternatives = existing?.alternatives ?? new Map<string, VisualizationSpec>();
|
|
85
|
-
|
|
88
|
+
const originalData = existing?.originalData;
|
|
89
|
+
return this.save(newSpec, columns, alternatives, originalData);
|
|
86
90
|
}
|
|
87
91
|
|
|
88
92
|
getAlternative(specId: string, patternId: string): VisualizationSpec | null {
|
|
@@ -185,7 +185,7 @@ export const dslQuerySchema = z.preprocess(normalizeDslQueryInput, dslQueryInner
|
|
|
185
185
|
|
|
186
186
|
// ─── DASHBOARD SCHEMAS ──────────────────────────────────────────────────────
|
|
187
187
|
|
|
188
|
-
const ALL_PALETTE_NAMES = [
|
|
188
|
+
export const ALL_PALETTE_NAMES = [
|
|
189
189
|
'categorical', 'blue', 'green', 'purple', 'warm',
|
|
190
190
|
'blueRed', 'greenPurple', 'tealOrange', 'redGreen',
|
|
191
191
|
'traffic-light', 'profit-loss', 'temperature',
|
|
@@ -272,8 +272,8 @@ const COLOR_SYSTEM_DOCS = {
|
|
|
272
272
|
],
|
|
273
273
|
},
|
|
274
274
|
howToApply: {
|
|
275
|
-
visualize: 'Pass
|
|
276
|
-
refine: 'Pass
|
|
275
|
+
visualize: 'Pass palette, highlight, colorField as top-level params in the visualize tool input',
|
|
276
|
+
refine: 'Pass structured params: palette, highlight: { values: [...] }, colorField, etc.',
|
|
277
277
|
},
|
|
278
278
|
};
|
|
279
279
|
|