graphein-mcp 0.18.0 → 0.20.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/README.md +55 -2
- package/dist/{chunk-5LAUAUAW.js → chunk-7DJMHUCG.js} +264 -188
- package/dist/chunk-7DJMHUCG.js.map +1 -0
- package/dist/index.d.ts +18 -4
- package/dist/index.js +3 -1
- package/dist/server.js +1 -1
- package/package.json +6 -5
- package/resources/agent-guide.md +188 -4
- package/resources/chart-spec.schema.json +108 -132
- package/resources/spec-reference.md +338 -31
- package/dist/chunk-5LAUAUAW.js.map +0 -1
package/README.md
CHANGED
|
@@ -36,13 +36,66 @@ npm install -g graphein-mcp # then: graphein-mcp
|
|
|
36
36
|
| Tool | What it does |
|
|
37
37
|
| --- | --- |
|
|
38
38
|
| **`render_chart`** | The one-call loop. Validates a `ChartSpec`, auto-repairs safe mistakes, renders a PNG, and returns the **image** plus a **vision-free critique** (render report + lint warnings + repairs applied). If the spec can't be made valid, returns structured errors with JSON-Patch fixes instead of an image. |
|
|
39
|
+
| **`critique_chart`** | Same validation/rendering policy, but report-only: no image block. |
|
|
40
|
+
| **`recommend_chart`** | Profile tidy rows (or CSV/TSV) and return ranked specs with rationale and unresolved data decisions. |
|
|
41
|
+
| **`list_chart_types`** | Every registered chart/slicer family with purpose, requirements, capabilities, and a runnable starter. Dashboards compose these visuals. |
|
|
39
42
|
| **`validate_chart`** | Validate without rendering. Returns structural errors (each with a JSON-Patch `fix` when unambiguous, plus "did you mean" suggestions) and best-practice lint warnings. |
|
|
40
43
|
| **`repair_chart`** | Apply every safe, unambiguous fix and return the corrected spec, the patch ops applied, and whether it's now valid. |
|
|
41
44
|
| **`summarize_chart`** | Deterministic, plain-English description of what the data shows (doubles as alt-text; no LLM). |
|
|
42
45
|
|
|
43
|
-
`render_chart`
|
|
44
|
-
(default `true`)
|
|
46
|
+
`render_chart` and `critique_chart` accept `spec` plus optional `width`, `height`,
|
|
47
|
+
`dpr`, `repair` (default `true`), `repairLevel` (`'safe'` default; `'data'` explicitly
|
|
48
|
+
permits data-aware authoring inference), and `quality`. Every type rasterizes — kpi, table, matrix, slicers and dashboard render
|
|
45
49
|
a static canvas snapshot, so the whole catalog returns an image + report.
|
|
50
|
+
`width`/`height` are limited to 1–8192 CSS pixels, `dpr` to 0.25–4, and the
|
|
51
|
+
rasterized canvas to 67,108,864 pixels; invalid sizes return a structured tool
|
|
52
|
+
error instead of allocating an unsafe canvas.
|
|
53
|
+
CSV/TSV parsing keeps a column as strings unless every value converts losslessly,
|
|
54
|
+
so leading-zero identifiers stay identifiers. Bundled resources are served only
|
|
55
|
+
from the package's committed resource set.
|
|
56
|
+
|
|
57
|
+
### Opt-in presentation improvement
|
|
58
|
+
|
|
59
|
+
The default remains **one render**. Set `"quality":true` (or
|
|
60
|
+
`"quality":{"maxPasses":3}`) to reuse core's bounded controller:
|
|
61
|
+
|
|
62
|
+
- At most **three total whole-visual render attempts**, including initial and
|
|
63
|
+
restoration passes. Never per diagnostic or dashboard child.
|
|
64
|
+
- Only absent, eligible presentation defaults can change. Explicit settings,
|
|
65
|
+
palettes/domains, encodings, and data are protected; semantic decisions stay with
|
|
66
|
+
the caller. `repair` / `repairLevel` remain separate authoring policies.
|
|
67
|
+
- Every candidate validates; no progress, regressions, repeated actions, or failures
|
|
68
|
+
stop the loop. Mutable targets reserve a rollback pass, so `maxPasses:1` or `2`
|
|
69
|
+
only evaluate the initial render.
|
|
70
|
+
- Opted-in results include **`effectiveSpec`** and **`quality`**
|
|
71
|
+
(`renderPasses`, `selectedPass`, `iterations`, `applied`, `rejected`, `stopReason`).
|
|
72
|
+
The PNG and full `report` match that selected spec. Remaining warnings and
|
|
73
|
+
incomplete evidence are not hidden.
|
|
74
|
+
- **`authoring`** includes the core input-row `profile` and selected-family
|
|
75
|
+
`capabilities` when available. Dashboard `authoring.views` identifies own-data profiles and
|
|
76
|
+
shared-data inheritance. This is supplied-input evidence before transforms,
|
|
77
|
+
filters, or selection effects, distinct from the final report's effective-row/draw
|
|
78
|
+
evidence. Differing counts or invalid-value findings are expected after explicit
|
|
79
|
+
preparation; profiling does not execute that pipeline or invent an encoding.
|
|
80
|
+
|
|
81
|
+
Rendering/critique responses expose the same JSON in the text block and MCP
|
|
82
|
+
`structuredContent`; existing top-level counts/diagnostics on image results remain
|
|
83
|
+
available. Invalid specs return structured validation errors and
|
|
84
|
+
`quality.stopReason:'invalid-spec'` with zero render passes, not an image.
|
|
85
|
+
|
|
86
|
+
### Data-driven authoring
|
|
87
|
+
|
|
88
|
+
`recommend_chart` preserves its `recommendations` array and adds the shared core
|
|
89
|
+
`profile`, `findings`, and `status` (`ready`, `needs-decision`, `no-candidate`).
|
|
90
|
+
Candidates include evidence and alternatives; a valid candidate may still require
|
|
91
|
+
a choice about duplicate positions, dates/identifiers, missing data, aggregation, or
|
|
92
|
+
geometry. Optional `targetSize:{width,height}` guides recommendations without
|
|
93
|
+
filtering/grouping rows. `list_chart_types` exposes each family's field roles,
|
|
94
|
+
requirements, cardinality guidance, supported features, and actual aggregation
|
|
95
|
+
semantics. Neither tool rewrites data to make a recommendation appear successful.
|
|
96
|
+
Validation/rendering/critique warning payloads preserve exact per-field
|
|
97
|
+
`evidence` counts and `requiresDecision`, so data-quality decisions are not lost
|
|
98
|
+
when the core findings are sent through MCP.
|
|
46
99
|
|
|
47
100
|
### Example result
|
|
48
101
|
|