graphein-mcp 0.16.2 → 0.18.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.
@@ -0,0 +1,646 @@
1
+ // src/tabular.ts
2
+ var TabularParseError = class extends Error {
3
+ /** Create a parse error with a human-readable message. */
4
+ constructor(message) {
5
+ super(message);
6
+ this.name = "TabularParseError";
7
+ }
8
+ };
9
+ function detectDelimiter(text2) {
10
+ let comma = 0;
11
+ let tab = 0;
12
+ let quoted = false;
13
+ for (let i = 0; i < text2.length; i++) {
14
+ const ch = text2[i];
15
+ if (ch === '"') {
16
+ if (quoted && text2[i + 1] === '"') {
17
+ i++;
18
+ } else {
19
+ quoted = !quoted;
20
+ }
21
+ } else if (!quoted && (ch === "\n" || ch === "\r")) {
22
+ break;
23
+ } else if (!quoted && ch === ",") {
24
+ comma++;
25
+ } else if (!quoted && ch === " ") {
26
+ tab++;
27
+ }
28
+ }
29
+ return tab > comma ? " " : ",";
30
+ }
31
+ function coerce(value) {
32
+ const trimmed = value.trim();
33
+ if (/^[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?$/.test(trimmed)) {
34
+ const n = Number(trimmed);
35
+ if (Number.isFinite(n)) return n;
36
+ }
37
+ return value;
38
+ }
39
+ function parseRecords(text2, delimiter) {
40
+ const records = [];
41
+ let record = [];
42
+ let value = "";
43
+ let quoted = false;
44
+ let afterQuote = false;
45
+ const pushCell = () => {
46
+ record.push({ value });
47
+ value = "";
48
+ afterQuote = false;
49
+ };
50
+ const pushRecord = () => {
51
+ pushCell();
52
+ records.push(record);
53
+ record = [];
54
+ };
55
+ for (let i = 0; i < text2.length; i++) {
56
+ const ch = text2[i];
57
+ if (quoted) {
58
+ if (ch === '"') {
59
+ if (text2[i + 1] === '"') {
60
+ value += '"';
61
+ i++;
62
+ } else {
63
+ quoted = false;
64
+ afterQuote = true;
65
+ }
66
+ } else {
67
+ value += ch;
68
+ }
69
+ continue;
70
+ }
71
+ if (afterQuote && ch !== delimiter && ch !== "\n" && ch !== "\r") {
72
+ if (/\s/.test(ch)) continue;
73
+ throw new TabularParseError(`Unexpected character '${ch}' after closing quote.`);
74
+ }
75
+ if (ch === '"') {
76
+ if (value.length > 0) throw new TabularParseError("Unexpected quote in an unquoted field.");
77
+ quoted = true;
78
+ } else if (ch === delimiter) {
79
+ pushCell();
80
+ } else if (ch === "\n") {
81
+ pushRecord();
82
+ } else if (ch === "\r") {
83
+ pushRecord();
84
+ if (text2[i + 1] === "\n") i++;
85
+ } else {
86
+ value += ch;
87
+ }
88
+ }
89
+ if (quoted) throw new TabularParseError("Unclosed quoted field.");
90
+ if (value.length > 0 || record.length > 0 || text2.endsWith(String(delimiter))) pushRecord();
91
+ return records.filter((r) => r.some((cell) => cell.value.length > 0));
92
+ }
93
+ function parseTabularText(text2) {
94
+ const trimmed = text2.replace(/^\uFEFF/, "");
95
+ const delimiter = detectDelimiter(trimmed);
96
+ const records = parseRecords(trimmed, delimiter);
97
+ if (records.length === 0) return [];
98
+ const headers = records[0].map((cell) => cell.value.trim());
99
+ if (headers.some((h) => h.length === 0)) {
100
+ throw new TabularParseError("CSV/TSV header row must not contain empty column names.");
101
+ }
102
+ if (new Set(headers).size !== headers.length) {
103
+ throw new TabularParseError("CSV/TSV header row must not contain duplicate column names.");
104
+ }
105
+ return records.slice(1).map((record, rowIndex) => {
106
+ if (record.length !== headers.length) {
107
+ throw new TabularParseError(
108
+ `Row ${rowIndex + 2} has ${record.length} cells, expected ${headers.length}.`
109
+ );
110
+ }
111
+ const row = {};
112
+ for (let i = 0; i < headers.length; i++) row[headers[i]] = coerce(record[i].value);
113
+ return row;
114
+ });
115
+ }
116
+ function parseInlineData(value) {
117
+ if (Array.isArray(value)) return value.map(parseInlineData);
118
+ if (typeof value !== "object" || value === null) return value;
119
+ const out = {};
120
+ for (const [key, child] of Object.entries(value)) {
121
+ out[key] = key === "data" && typeof child === "string" ? parseTabularText(child) : parseInlineData(child);
122
+ }
123
+ return out;
124
+ }
125
+
126
+ // src/handlers.ts
127
+ import {
128
+ validateSpec,
129
+ repairSpec,
130
+ recommendChart,
131
+ listChartTypes,
132
+ summarize
133
+ } from "graphein";
134
+ import { renderChart } from "@graphein/node";
135
+ function text(value) {
136
+ return { type: "text", text: value };
137
+ }
138
+ function json(value) {
139
+ return text(JSON.stringify(value, null, 2));
140
+ }
141
+ function specType(spec) {
142
+ return typeof spec === "object" && spec !== null && "type" in spec ? String(spec.type) : "(missing)";
143
+ }
144
+ function isRecommendIntent(value) {
145
+ return value === void 0 || value === "trend" || value === "comparison" || value === "distribution" || value === "relationship" || value === "composition";
146
+ }
147
+ function parseErrorResult(e) {
148
+ return {
149
+ isError: true,
150
+ content: [
151
+ json({
152
+ ok: false,
153
+ stage: "parse-data",
154
+ message: e instanceof Error ? e.message : String(e)
155
+ })
156
+ ]
157
+ };
158
+ }
159
+ function specWithParsedData(spec) {
160
+ return parseInlineData(spec);
161
+ }
162
+ function rowsWithParsedData(data) {
163
+ return typeof data === "string" ? parseTabularText(data) : data;
164
+ }
165
+ function tidyError(e) {
166
+ const out = { path: e.path, message: e.message };
167
+ if (e.rule) out.rule = e.rule;
168
+ if (e.severity) out.severity = e.severity;
169
+ if (e.fix) out.fix = e.fix;
170
+ if (e.suggestion) out.suggestion = e.suggestion;
171
+ return out;
172
+ }
173
+ function renderChartHandler(args) {
174
+ const { spec, width, height, dpr, repair = true } = args;
175
+ let working;
176
+ try {
177
+ working = specWithParsedData(spec);
178
+ } catch (e) {
179
+ return parseErrorResult(e);
180
+ }
181
+ let validation = validateSpec(working);
182
+ let repairs = [];
183
+ if (!validation.valid && repair) {
184
+ const repaired = repairSpec(working);
185
+ if (repaired.applied.length > 0) {
186
+ working = repaired.spec;
187
+ repairs = repaired.applied;
188
+ validation = validateSpec(working);
189
+ }
190
+ }
191
+ if (!validation.valid) {
192
+ return {
193
+ isError: true,
194
+ content: [
195
+ json({
196
+ ok: false,
197
+ rendered: false,
198
+ stage: "validate",
199
+ type: specType(working),
200
+ errors: validation.errors.map(tidyError),
201
+ lint: validation.warnings.map(tidyError),
202
+ repairsApplied: repairs,
203
+ hint: "Apply each error.fix JSON Patch (or the repair_chart tool), then call render_chart again. See the graphein://agent-guide and graphein://schema resources."
204
+ })
205
+ ]
206
+ };
207
+ }
208
+ const type = specType(working);
209
+ try {
210
+ const { png, report, width: pxW, height: pxH } = renderChart(working, {
211
+ width,
212
+ height,
213
+ dpr
214
+ });
215
+ return {
216
+ isError: false,
217
+ content: [
218
+ { type: "image", data: png.toString("base64"), mimeType: "image/png" },
219
+ json({
220
+ ok: report.ok,
221
+ rendered: true,
222
+ type,
223
+ pixelSize: { width: pxW, height: pxH },
224
+ summary: report.summary,
225
+ marks: report.markCount,
226
+ series: report.seriesCount,
227
+ colors: report.colorCount,
228
+ diagnostics: report.diagnostics,
229
+ lint: validation.warnings.map(tidyError),
230
+ repairsApplied: repairs
231
+ })
232
+ ]
233
+ };
234
+ } catch (e) {
235
+ return {
236
+ isError: true,
237
+ content: [
238
+ json({
239
+ ok: false,
240
+ rendered: false,
241
+ stage: "render",
242
+ type,
243
+ message: e instanceof Error ? e.message : String(e),
244
+ summary: summarize(working) || void 0,
245
+ repairsApplied: repairs
246
+ })
247
+ ]
248
+ };
249
+ }
250
+ }
251
+ function critiqueChartHandler(args) {
252
+ const { spec, width, height, dpr, repair = true } = args;
253
+ let working;
254
+ try {
255
+ working = specWithParsedData(spec);
256
+ } catch (e) {
257
+ return parseErrorResult(e);
258
+ }
259
+ let validation = validateSpec(working);
260
+ let repairs = [];
261
+ if (!validation.valid && repair) {
262
+ const repaired = repairSpec(working);
263
+ if (repaired.applied.length > 0) {
264
+ working = repaired.spec;
265
+ repairs = repaired.applied;
266
+ validation = validateSpec(working);
267
+ }
268
+ }
269
+ if (!validation.valid) {
270
+ return {
271
+ isError: true,
272
+ content: [
273
+ json({
274
+ ok: false,
275
+ rendered: false,
276
+ stage: "validate",
277
+ type: specType(working),
278
+ errors: validation.errors.map(tidyError),
279
+ lint: validation.warnings.map(tidyError),
280
+ repairsApplied: repairs,
281
+ hint: "Apply each error.fix JSON Patch (or the repair_chart tool), then call critique_chart again."
282
+ })
283
+ ]
284
+ };
285
+ }
286
+ const type = specType(working);
287
+ try {
288
+ const { report, width: pxW, height: pxH } = renderChart(working, { width, height, dpr });
289
+ return {
290
+ isError: false,
291
+ content: [
292
+ json({
293
+ ok: report.ok,
294
+ rendered: true,
295
+ type,
296
+ pixelSize: { width: pxW, height: pxH },
297
+ summary: report.summary,
298
+ report,
299
+ lint: validation.warnings.map(tidyError),
300
+ repairsApplied: repairs
301
+ })
302
+ ]
303
+ };
304
+ } catch (e) {
305
+ return {
306
+ isError: true,
307
+ content: [
308
+ json({
309
+ ok: false,
310
+ rendered: false,
311
+ stage: "render",
312
+ type,
313
+ message: e instanceof Error ? e.message : String(e),
314
+ summary: summarize(working) || void 0,
315
+ repairsApplied: repairs
316
+ })
317
+ ]
318
+ };
319
+ }
320
+ }
321
+ function validateChartHandler(args) {
322
+ let spec;
323
+ try {
324
+ spec = specWithParsedData(args.spec);
325
+ } catch (e) {
326
+ return parseErrorResult(e);
327
+ }
328
+ const result = validateSpec(spec);
329
+ return {
330
+ isError: false,
331
+ content: [
332
+ json({
333
+ valid: result.valid,
334
+ type: specType(spec),
335
+ errors: result.errors.map(tidyError),
336
+ warnings: result.warnings.map(tidyError)
337
+ })
338
+ ]
339
+ };
340
+ }
341
+ function recommendChartHandler(args) {
342
+ if (!isRecommendIntent(args.intent)) {
343
+ return {
344
+ isError: true,
345
+ content: [
346
+ json({
347
+ ok: false,
348
+ message: "Unsupported intent. Expected trend, comparison, distribution, relationship, or composition."
349
+ })
350
+ ]
351
+ };
352
+ }
353
+ let data;
354
+ try {
355
+ data = rowsWithParsedData(args.data);
356
+ } catch (e) {
357
+ return parseErrorResult(e);
358
+ }
359
+ return {
360
+ isError: false,
361
+ content: [
362
+ json({
363
+ ok: true,
364
+ recommendations: recommendChart(data, { intent: args.intent, maxResults: args.maxResults })
365
+ })
366
+ ]
367
+ };
368
+ }
369
+ function listChartTypesHandler() {
370
+ return {
371
+ isError: false,
372
+ content: [
373
+ json({
374
+ ok: true,
375
+ chartTypes: listChartTypes()
376
+ })
377
+ ]
378
+ };
379
+ }
380
+ function repairChartHandler(args) {
381
+ let input;
382
+ try {
383
+ input = specWithParsedData(args.spec);
384
+ } catch (e) {
385
+ return parseErrorResult(e);
386
+ }
387
+ const { spec, applied, appliedDetails, remaining } = repairSpec(input, { level: args.level ?? "safe" });
388
+ return {
389
+ isError: false,
390
+ content: [
391
+ json({
392
+ valid: remaining.length === 0,
393
+ level: args.level ?? "safe",
394
+ applied,
395
+ appliedDetails,
396
+ remaining: remaining.map(tidyError),
397
+ spec
398
+ })
399
+ ]
400
+ };
401
+ }
402
+ function summarizeChartHandler(args) {
403
+ let spec;
404
+ try {
405
+ spec = specWithParsedData(args.spec);
406
+ } catch (e) {
407
+ return parseErrorResult(e);
408
+ }
409
+ const result = validateSpec(spec);
410
+ if (!result.valid) {
411
+ return {
412
+ isError: true,
413
+ content: [
414
+ json({
415
+ summary: null,
416
+ reason: "Spec is invalid; fix it first (validate_chart / repair_chart).",
417
+ errors: result.errors.map(tidyError)
418
+ })
419
+ ]
420
+ };
421
+ }
422
+ const summary = summarize(spec);
423
+ return {
424
+ isError: false,
425
+ content: [
426
+ text(summary || `(No narrative summary is available for a '${specType(args.spec)}' chart.)`)
427
+ ]
428
+ };
429
+ }
430
+
431
+ // src/resources.ts
432
+ import { readFileSync } from "fs";
433
+ import { fileURLToPath } from "url";
434
+ var RESOURCES = [
435
+ {
436
+ name: "schema",
437
+ uri: "graphein://schema",
438
+ title: "Graphein ChartSpec JSON Schema",
439
+ description: "The machine-readable JSON Schema for every Graphein ChartSpec and DashboardSpec field \u2014 chart types, channels, transforms, annotations, and required properties. Generate or check a spec against this.",
440
+ mimeType: "application/json",
441
+ file: "chart-spec.schema.json"
442
+ },
443
+ {
444
+ name: "agent-guide",
445
+ uri: "graphein://agent-guide",
446
+ title: "Graphein Agent Guide",
447
+ description: "A task-oriented guide for producing correct Graphein charts: the one-rule workflow, choosing a chart type, encodings, transforms, the validate \u2192 repair \u2192 render \u2192 critique loop, and worked recipes. Read this first.",
448
+ mimeType: "text/markdown",
449
+ file: "agent-guide.md"
450
+ },
451
+ {
452
+ name: "spec-reference",
453
+ uri: "graphein://spec-reference",
454
+ title: "Graphein Spec Reference",
455
+ description: "The exhaustive field-by-field reference for every chart type, channel, transform, annotation, and modifier. Consult this for the precise shape of a specific field.",
456
+ mimeType: "text/markdown",
457
+ file: "spec-reference.md"
458
+ }
459
+ ];
460
+ var cache = /* @__PURE__ */ new Map();
461
+ function readResourceFile(file) {
462
+ const hit = cache.get(file);
463
+ if (hit !== void 0) return hit;
464
+ const url = new URL(`../resources/${file}`, import.meta.url);
465
+ const text2 = readFileSync(fileURLToPath(url), "utf8");
466
+ cache.set(file, text2);
467
+ return text2;
468
+ }
469
+ function resourceByUri(uri) {
470
+ return RESOURCES.find((r) => r.uri === uri);
471
+ }
472
+
473
+ // src/create-server.ts
474
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
475
+ import { z } from "zod";
476
+ var VERSION = "0.3.0";
477
+ var SERVER_INSTRUCTIONS = `Graphein is an agent-first data-visualization library: you describe a chart as one JSON ChartSpec ({ type, data, encoding, ... }) and it renders. This server lets you build correct charts without prior knowledge of the API.
478
+
479
+ Workflow:
480
+ 1. Call list_chart_types to see every supported chart type with required channels and starter specs; read graphein://agent-guide (and graphein://schema for exact fields) only when you need deeper detail.
481
+ 2. Shape data as tidy rows \u2014 one row per observation, one column per variable. Tools that accept rows also accept CSV/TSV text with a header row.
482
+ 3. Use recommend_chart when you want ranked specs from data, or start from a list_chart_types starter.
483
+ 4. Emit a ChartSpec and call critique_chart for report-only diagnostics, or render_chart when you need the PNG plus critique. Both validate, auto-repair safe mistakes, render headlessly, and return lint/report feedback.
484
+ 5. If a spec is invalid, validate_chart, critique_chart, and render_chart return structured errors with JSON-Patch fixes. Apply them or call repair_chart; use repair_chart level "data" to infer missing encodings or close field-name typos from the spec's own data.
485
+ Use summarize_chart for deterministic alt-text. Every type rasterizes headlessly, including kpi, table, matrix, slicers and dashboard (static canvas snapshots).`;
486
+ var specSchema = z.record(z.string(), z.unknown()).describe(
487
+ 'A Graphein ChartSpec or DashboardSpec object, e.g. { "type": "line", "data": [...], "encoding": {...} }. Any data property may be tidy rows or CSV/TSV text with a header row. See the graphein://schema and graphein://agent-guide resources.'
488
+ );
489
+ var dataRowsSchema = z.union([
490
+ z.array(z.record(z.string(), z.any())),
491
+ z.string().describe("CSV or TSV text with a header row; quoted delimiters, quotes, and newlines are supported.")
492
+ ]);
493
+ var intentSchema = z.enum(["trend", "comparison", "distribution", "relationship", "composition"]).optional().describe(
494
+ "Optional analytical intent used to rank recommendations: trend, comparison, distribution, relationship, or composition."
495
+ );
496
+ function createServer() {
497
+ const server = new McpServer(
498
+ { name: "graphein-mcp", version: VERSION },
499
+ { instructions: SERVER_INSTRUCTIONS }
500
+ );
501
+ server.registerTool(
502
+ "render_chart",
503
+ {
504
+ title: "Render a Graphein chart",
505
+ description: "The one-call loop: validate a ChartSpec, auto-repair safe mistakes, render it to a PNG, and return the image plus a vision-free critique (render report, lint warnings, repairs applied). If the spec cannot be made valid, returns structured errors with JSON-Patch fixes instead of an image. Every type rasterizes headlessly \u2014 kpi, table, matrix, slicers and dashboard render static canvas snapshots.",
506
+ inputSchema: {
507
+ spec: specSchema,
508
+ width: z.number().int().positive().optional().describe("Logical width in CSS px (default 800)."),
509
+ height: z.number().int().positive().optional().describe("Logical height in CSS px (default 500)."),
510
+ dpr: z.number().positive().optional().describe("Device pixel ratio for crisp output (default 2)."),
511
+ repair: z.boolean().optional().describe("Auto-apply safe repairs before rendering when the spec is invalid (default true).")
512
+ }
513
+ },
514
+ async (args) => renderChartHandler(args)
515
+ );
516
+ server.registerTool(
517
+ "critique_chart",
518
+ {
519
+ title: "Critique a Graphein chart without an image",
520
+ description: "Validate a ChartSpec, auto-repair safe mistakes, render it headlessly, and return only the RenderReport, deterministic summary, lint warnings, and repairs applied \u2014 no base64 PNG. Use this when you need diagnostics but not an image.",
521
+ inputSchema: {
522
+ spec: specSchema,
523
+ width: z.number().int().positive().optional().describe("Logical width in CSS px (default 800)."),
524
+ height: z.number().int().positive().optional().describe("Logical height in CSS px (default 500)."),
525
+ dpr: z.number().positive().optional().describe("Device pixel ratio for layout parity (default 2)."),
526
+ repair: z.boolean().optional().describe("Auto-apply safe repairs before rendering when the spec is invalid (default true).")
527
+ }
528
+ },
529
+ async (args) => critiqueChartHandler(args)
530
+ );
531
+ server.registerTool(
532
+ "validate_chart",
533
+ {
534
+ title: "Validate a Graphein chart spec",
535
+ description: 'Validate a ChartSpec without rendering. Returns structural errors (each with a JSON-Patch `fix` when unambiguous, plus "did you mean" suggestions) and best-practice lint warnings. Fast feedback before rendering.',
536
+ inputSchema: { spec: specSchema }
537
+ },
538
+ async (args) => validateChartHandler(args)
539
+ );
540
+ server.registerTool(
541
+ "recommend_chart",
542
+ {
543
+ title: "Recommend Graphein chart specs",
544
+ description: "Profile tidy rows and return ranked, ready-to-render ChartSpecs with rationale. Use this before guessing a chart type or encoding.",
545
+ inputSchema: {
546
+ data: dataRowsSchema,
547
+ intent: intentSchema,
548
+ maxResults: z.number().int().positive().optional()
549
+ }
550
+ },
551
+ async (args) => recommendChartHandler(args)
552
+ );
553
+ server.registerTool(
554
+ "repair_chart",
555
+ {
556
+ title: "Repair a Graphein chart spec",
557
+ description: `Apply Graphein repairs and return the corrected spec, JSON Patch ops, per-patch rationales, and whether it is now valid. The default safe level applies validator-provided fixes; level "data" may infer missing encodings and field-name typo fixes from the spec's own data.`,
558
+ inputSchema: {
559
+ spec: specSchema,
560
+ level: z.enum(["safe", "data"]).optional().describe('Repair aggressiveness. "safe" is default; "data" also infers from the spec data.')
561
+ }
562
+ },
563
+ async (args) => repairChartHandler(args)
564
+ );
565
+ server.registerTool(
566
+ "list_chart_types",
567
+ {
568
+ title: "List Graphein chart types",
569
+ description: "Return every supported chart type with its purpose, required channels/properties, and a minimal runnable starter spec. Use this before reading the full schema when you just need to know what chart families exist.",
570
+ inputSchema: {}
571
+ },
572
+ async () => listChartTypesHandler()
573
+ );
574
+ server.registerTool(
575
+ "summarize_chart",
576
+ {
577
+ title: "Summarize a Graphein chart",
578
+ description: `Return a deterministic, plain-English description of what the chart's data shows (e.g. "Users grew 46% over six months, peaking in June"). Doubles as alt-text; needs no LLM.`,
579
+ inputSchema: { spec: specSchema }
580
+ },
581
+ async (args) => summarizeChartHandler(args)
582
+ );
583
+ for (const r of RESOURCES) {
584
+ server.registerResource(
585
+ r.name,
586
+ r.uri,
587
+ { title: r.title, description: r.description, mimeType: r.mimeType },
588
+ async (uri) => ({
589
+ contents: [{ uri: uri.href, mimeType: r.mimeType, text: readResourceFile(r.file) }]
590
+ })
591
+ );
592
+ }
593
+ server.registerPrompt(
594
+ "create_chart",
595
+ {
596
+ title: "Create a Graphein chart",
597
+ description: "Scaffold the workflow for building a validated Graphein chart from a goal (and optional data).",
598
+ argsSchema: {
599
+ goal: z.string().describe('What the chart should show, e.g. "monthly active users over the last year".'),
600
+ data: z.string().optional().describe("Optional: the data as a JSON array, or a description of the columns available.")
601
+ }
602
+ },
603
+ ({ goal, data }) => ({
604
+ messages: [
605
+ {
606
+ role: "user",
607
+ content: {
608
+ type: "text",
609
+ text: `Build a Graphein chart for this goal:
610
+
611
+ ${goal}
612
+ ${data ? `
613
+ Data:
614
+ ${data}
615
+ ` : ""}
616
+ Steps:
617
+ 1. Call list_chart_types for available chart families and starter specs; read graphein://agent-guide or graphein://schema only for deeper details.
618
+ 2. Shape the data as tidy rows \u2014 one row per observation, one column per variable. CSV/TSV text with a header row is accepted anywhere data rows are accepted.
619
+ 3. Choose a chart type (or call recommend_chart) and write a single ChartSpec ({ type, data, encoding, title }).
620
+ 4. Call critique_chart for report-only feedback or render_chart when you need the PNG too. Read the returned render report + lint to confirm it looks right.
621
+ 5. If it reports errors, apply each error.fix patch (or call repair_chart, using level "data" when field/encoding inference from data is useful) and render again \u2014 do not regenerate from scratch.`
622
+ }
623
+ }
624
+ ]
625
+ })
626
+ );
627
+ return server;
628
+ }
629
+
630
+ export {
631
+ TabularParseError,
632
+ parseTabularText,
633
+ parseInlineData,
634
+ renderChartHandler,
635
+ critiqueChartHandler,
636
+ validateChartHandler,
637
+ listChartTypesHandler,
638
+ repairChartHandler,
639
+ summarizeChartHandler,
640
+ RESOURCES,
641
+ readResourceFile,
642
+ resourceByUri,
643
+ VERSION,
644
+ createServer
645
+ };
646
+ //# sourceMappingURL=chunk-5LAUAUAW.js.map