@iflow-mcp/kamranbiglari-mcp-server-chart 1.0.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.
Files changed (52) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +264 -0
  3. package/biome.json +49 -0
  4. package/dist/charts/bar.js +43 -0
  5. package/dist/charts/bubble.js +71 -0
  6. package/dist/charts/doughnut.js +104 -0
  7. package/dist/charts/gauge.js +84 -0
  8. package/dist/charts/index.js +15 -0
  9. package/dist/charts/line.js +74 -0
  10. package/dist/charts/ohlc.js +455 -0
  11. package/dist/charts/pie.js +50 -0
  12. package/dist/charts/polarArea.js +50 -0
  13. package/dist/charts/progressBar.js +50 -0
  14. package/dist/charts/radar.js +59 -0
  15. package/dist/charts/radialGauge.js +43 -0
  16. package/dist/charts/sankey.js +64 -0
  17. package/dist/charts/scatter.js +70 -0
  18. package/dist/charts/sparkline.js +43 -0
  19. package/dist/charts/violin.js +67 -0
  20. package/dist/index.js +236 -0
  21. package/dist/stdio-server.js +58 -0
  22. package/dist/utils/index.js +1 -0
  23. package/dist/utils/schema.js +9 -0
  24. package/image.png +0 -0
  25. package/language.json +1 -0
  26. package/package.json +1 -0
  27. package/package_name +1 -0
  28. package/push_info.json +5 -0
  29. package/screenshot/image.png +0 -0
  30. package/src/charts/bar.ts +48 -0
  31. package/src/charts/bubble.ts +78 -0
  32. package/src/charts/doughnut.ts +117 -0
  33. package/src/charts/gauge.ts +92 -0
  34. package/src/charts/index.ts +15 -0
  35. package/src/charts/line.ts +80 -0
  36. package/src/charts/ohlc.ts +474 -0
  37. package/src/charts/pie.ts +56 -0
  38. package/src/charts/polarArea.ts +56 -0
  39. package/src/charts/progressBar.ts +56 -0
  40. package/src/charts/radar.ts +65 -0
  41. package/src/charts/radialGauge.ts +49 -0
  42. package/src/charts/sankey.ts +71 -0
  43. package/src/charts/scatter.ts +77 -0
  44. package/src/charts/sparkline.ts +49 -0
  45. package/src/charts/violin.ts +73 -0
  46. package/src/index.ts +279 -0
  47. package/src/stdio-server.ts +77 -0
  48. package/src/utils/index.ts +1 -0
  49. package/src/utils/schema.ts +10 -0
  50. package/tsconfig.json +1 -0
  51. package/worker-configuration.d.ts +5709 -0
  52. package/wrangler.jsonc +28 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Kamran Biglari
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,264 @@
1
+ # MCP Chart Server
2
+
3
+ A Model Context Protocol (MCP) server that provides comprehensive chart generation capabilities. This server offers a wide variety of chart types with comprehensive Zod schema validation for type-safe chart configuration.
4
+
5
+ ## Claude.AI Integration (Free Running Version)
6
+
7
+ For immediate use with Claude.AI without local setup, use these public endpoints:
8
+
9
+ - **Streamable HTTP**: `https://chart.mcp.cloudcertainty.com/mcp`
10
+ - **Server-Sent Events**: `https://chart.mcp.cloudcertainty.com/sse`
11
+
12
+ Simply add either endpoint to your Claude.AI MCP configuration to start generating charts immediately.
13
+
14
+ ![Claude AI](screenshot/image.png)
15
+
16
+ ## Features
17
+
18
+ - 🎯 **15+ Chart Types** - Comprehensive chart library covering all major visualization needs
19
+ - 🔒 **Type Safety** - Full Zod schema validation for all chart configurations
20
+ - 🌐 **Multiple Deployment Options** - Local server, HTTP streaming, and SSE endpoints
21
+ - 🚀 **Claude.AI Integration** - Ready-to-use endpoints for Claude.AI integration
22
+ - 📊 **Professional Charts** - Support for financial, statistical, and business visualizations
23
+
24
+ ## Chart Types Supported
25
+
26
+ ### Basic Charts
27
+ - **Bar Chart** - Traditional bar charts with multiple datasets
28
+ - **Line Chart** - Line charts with customizable styling and fill options
29
+ - **Pie Chart** - Pie charts with hover effects and custom colors
30
+ - **Radar Chart** - Multi-axis radar charts for comparative analysis
31
+ - **Polar Area Chart** - Radial area charts for cyclical data
32
+
33
+ ### Advanced Charts
34
+ - **Doughnut Chart** - Enhanced pie charts with center labels and semi-circle support
35
+ - **Scatter Plot** - X/Y coordinate plotting with optional trend lines
36
+ - **Bubble Chart** - Three-dimensional data visualization with bubble sizes
37
+ - **OHLC Chart** - Financial candlestick charts with volume and indicators
38
+
39
+ ### Specialized Charts
40
+ - **Violin Plot** - Statistical distribution visualization
41
+ - **Gauge Chart** - Customizable gauge meters with thresholds
42
+ - **Radial Gauge** - Simple radial progress indicators
43
+ - **Progress Bar** - Linear progress indicators
44
+ - **Sparkline** - Minimal trend visualization
45
+ - **Sankey Diagram** - Flow and process visualization
46
+
47
+ ## Quick Start
48
+
49
+ ### Local Development
50
+
51
+ 1. **Clone the repository**
52
+ ```bash
53
+ git clone https://github.com/KamranBiglari/mcp-server-chart.git
54
+ cd mcp-server-chart
55
+ ```
56
+
57
+ 2. **Install dependencies**
58
+ ```bash
59
+ npm install
60
+ ```
61
+
62
+ 3. **Build the project**
63
+ ```bash
64
+ npm run build
65
+ ```
66
+
67
+ 4. **Run the server**
68
+ ```bash
69
+ npm start
70
+ ```
71
+
72
+ ## Usage Examples
73
+
74
+ ### Basic Bar Chart
75
+ ```json
76
+ {
77
+ "type": "bar",
78
+ "data": {
79
+ "labels": ["January", "February", "March", "April", "May"],
80
+ "datasets": [
81
+ { "label": "Sales", "data": [50, 60, 70, 180, 190] },
82
+ { "label": "Expenses", "data": [100, 200, 300, 400, 500] }
83
+ ]
84
+ }
85
+ }
86
+ ```
87
+
88
+ ### Financial OHLC Chart
89
+ ```json
90
+ {
91
+ "type": "ohlc",
92
+ "data": {
93
+ "datasets": [
94
+ {
95
+ "label": "MSFT",
96
+ "data": [
97
+ {"x": 1459468800000, "o": 18.23, "h": 19.36, "l": 18.18, "c": 19.31}
98
+ ],
99
+ "color": {"up": "#26a69a", "down": "#ef5350", "unchanged": "#999"}
100
+ }
101
+ ]
102
+ }
103
+ }
104
+ ```
105
+
106
+ ### Advanced Doughnut Chart
107
+ ```json
108
+ {
109
+ "type": "doughnut",
110
+ "data": {
111
+ "labels": ["Complete", "Remaining"],
112
+ "datasets": [{"data": [75, 25], "backgroundColor": ["#4CAF50", "#E0E0E0"]}]
113
+ },
114
+ "options": {
115
+ "circumference": 3.14159,
116
+ "rotation": 3.14159,
117
+ "plugins": {
118
+ "doughnutlabel": {
119
+ "labels": [{"text": "75%", "font": {"size": 24}}]
120
+ }
121
+ }
122
+ }
123
+ }
124
+ ```
125
+
126
+ ### Scatter Plot
127
+ ```json
128
+ {
129
+ "type": "scatter",
130
+ "data": {
131
+ "datasets": [
132
+ {
133
+ "label": "Dataset 1",
134
+ "data": [
135
+ {"x": 2, "y": 4},
136
+ {"x": 3, "y": 3},
137
+ {"x": 5, "y": 8}
138
+ ]
139
+ }
140
+ ]
141
+ }
142
+ }
143
+ ```
144
+
145
+ ## Configuration
146
+
147
+ ### MCP Client Configuration
148
+
149
+ Add to your MCP client configuration:
150
+
151
+ ```json
152
+ {
153
+ "mcpServers": {
154
+ "chart-server": {
155
+ "command": "node",
156
+ "args": ["path/to/mcp-server-chart/dist/index.js"]
157
+ }
158
+ }
159
+ }
160
+ ```
161
+
162
+ ### Claude.AI Configuration
163
+
164
+ For Claude.AI integration, add one of these endpoints:
165
+
166
+ ```json
167
+ {
168
+ "mcpServers": {
169
+ "chart-server": {
170
+ "url": "https://chart.mcp.cloudcertainty.com/mcp"
171
+ }
172
+ }
173
+ }
174
+ ```
175
+
176
+ ## Development
177
+
178
+ ### Project Structure
179
+ ```
180
+ src/
181
+ ├── charts/ # Chart type definitions
182
+ │ ├── bar.ts # Bar chart schema
183
+ │ ├── line.ts # Line chart schema
184
+ │ ├── ohlc.ts # OHLC chart schema
185
+ │ └── ... # Other chart types
186
+ ├── utils/ # Utility functions
187
+ │ ├── index.ts # Zod to JSON schema conversion
188
+ │ └── schema.ts # Common schema definitions
189
+ └── index.ts # Main MCP server
190
+ ```
191
+
192
+ ### Building
193
+ ```bash
194
+ npm run build # Build TypeScript
195
+ npm run dev # Development mode with watch
196
+ npm run lint # Run linting
197
+ ```
198
+
199
+ ### Testing
200
+ ```bash
201
+ npm test # Run test suite
202
+ npm run test:watch # Watch mode testing
203
+ ```
204
+
205
+ ## Chart Type Reference
206
+
207
+ | Chart Type | Use Case | Data Format |
208
+ |------------|----------|-------------|
209
+ | `bar` | Categorical comparisons | `{labels: string[], datasets: {data: number[]}[]}` |
210
+ | `line` | Trends over time | `{labels: string[], datasets: {data: number[]}[]}` |
211
+ | `pie` | Part-to-whole relationships | `{labels: string[], datasets: {data: number[]}[]}` |
212
+ | `doughnut` | Enhanced pie charts | `{labels: string[], datasets: {data: number[]}[]}` |
213
+ | `radar` | Multi-variable comparison | `{labels: string[], datasets: {data: number[]}[]}` |
214
+ | `polarArea` | Cyclical data | `{labels: string[], datasets: {data: number[]}[]}` |
215
+ | `scatter` | Correlation analysis | `{datasets: {data: {x: number, y: number}[]}[]}` |
216
+ | `bubble` | Three-dimensional data | `{datasets: {data: {x: number, y: number, r: number}[]}[]}` |
217
+ | `ohlc` | Financial data | `{datasets: {data: {x: number, o: number, h: number, l: number, c: number}[]}[]}` |
218
+ | `violin` | Statistical distributions | `{labels: string[], datasets: {data: number[][]}[]}` |
219
+ | `gauge` | KPI dashboards | `{datasets: {value: number, data: number[]}[]}` |
220
+ | `sankey` | Process flows | `{datasets: {data: {from: string, to: string, flow: number}[]}[]}` |
221
+
222
+ ## API Reference
223
+
224
+ ### Tools Available
225
+
226
+ All chart types are available as MCP tools with the following pattern:
227
+ - Tool name matches chart type (e.g., `bar`, `line`, `ohlc`)
228
+ - Input schema validates chart configuration
229
+ - Returns generated chart data
230
+
231
+ ### Schema Validation
232
+
233
+ Every chart type includes comprehensive Zod schemas that validate:
234
+ - Chart type and structure
235
+ - Data format and types
236
+ - Styling options
237
+ - Chart-specific configurations
238
+
239
+ ## Contributing
240
+
241
+ 1. Fork the repository
242
+ 2. Create a feature branch
243
+ 3. Add your chart type or improvement
244
+ 4. Include tests and documentation
245
+ 5. Submit a pull request
246
+
247
+ ## License
248
+
249
+ MIT License - see LICENSE file for details
250
+
251
+ ## Support
252
+
253
+ - 📚 Documentation: Check the inline schema documentation
254
+ - 🐛 Issues: Report bugs via GitHub Issues
255
+ - 💬 Discussions: Use GitHub Discussions for questions
256
+ - 🌐 Live Demo: Try the public endpoints with Claude.AI
257
+
258
+ ## Roadmap
259
+
260
+ - [ ] Real-time data binding
261
+ - [ ] Custom theme support
262
+ - [ ] Export formats (PNG, SVG, PDF)
263
+ - [ ] Animation and interaction options
264
+ - [ ] Dashboard layout compositions
package/biome.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "$schema": "https://biomejs.dev/schemas/2.0.4/schema.json",
3
+ "assist": {
4
+ "actions": {
5
+ "source": {
6
+ "useSortedKeys": "on"
7
+ }
8
+ },
9
+ "enabled": true
10
+ },
11
+ "files": {
12
+ "includes": ["!worker-configuration.d.ts"]
13
+ },
14
+ "formatter": {
15
+ "enabled": true,
16
+ "indentWidth": 4,
17
+ "lineWidth": 100
18
+ },
19
+ "linter": {
20
+ "enabled": true,
21
+ "rules": {
22
+ "recommended": true,
23
+ "style": {
24
+ "noInferrableTypes": "error",
25
+ "noNonNullAssertion": "off",
26
+ "noParameterAssign": "error",
27
+ "noUnusedTemplateLiteral": "error",
28
+ "noUselessElse": "error",
29
+ "useAsConstAssertion": "error",
30
+ "useDefaultParameterLast": "error",
31
+ "useEnumInitializers": "error",
32
+ "useNumberNamespace": "error",
33
+ "useSelfClosingElements": "error",
34
+ "useSingleVarDeclarator": "error"
35
+ },
36
+ "suspicious": {
37
+ "noConfusingVoidType": "off",
38
+ "noDebugger": "off",
39
+ "noExplicitAny": "off"
40
+ }
41
+ }
42
+ },
43
+ "root": false,
44
+ "vcs": {
45
+ "clientKind": "git",
46
+ "enabled": true,
47
+ "useIgnoreFile": true
48
+ }
49
+ }
@@ -0,0 +1,43 @@
1
+ import { z } from "zod";
2
+ import { zodToJsonSchema } from "../utils/index.js";
3
+ // Define the schema for the bar chart
4
+ // {
5
+ // type: 'bar',
6
+ // data: {
7
+ // labels: ['January', 'February', 'March', 'April', 'May'],
8
+ // datasets: [
9
+ // { label: 'Dogs', data: [50, 60, 70, 180, 190] },
10
+ // { label: 'Cats', data: [100, 200, 300, 400, 500] },
11
+ // ],
12
+ // },
13
+ // }
14
+ const schema = {
15
+ type: z.literal("bar").default("bar"),
16
+ data: z.object({
17
+ labels: z.array(z.string()).describe("Labels for the x-axis"),
18
+ datasets: z.array(z.object({
19
+ label: z.string().describe("Label for the dataset"),
20
+ data: z.array(z.number()).describe("Data points for the dataset"),
21
+ })),
22
+ }),
23
+ };
24
+ const tool = {
25
+ name: "bar",
26
+ description: `Generates a bar chart with the provided data.
27
+ example input:
28
+ \`\`\`json
29
+ {
30
+ "labels": ["January", "February", "March", "April", "May"],
31
+ "datasets": [
32
+ { "label": "Dogs", "data": [50, 60, 70, 180, 190] },
33
+ { "label": "Cats", "data": [100, 200, 300, 400, 500] }
34
+ ]
35
+ }
36
+ \`\`\`
37
+ `,
38
+ inputSchema: zodToJsonSchema(schema),
39
+ };
40
+ export const bar = {
41
+ schema,
42
+ tool,
43
+ };
@@ -0,0 +1,71 @@
1
+ import { z } from "zod";
2
+ import { zodToJsonSchema } from "../utils/index.js";
3
+ // Define the schema for the bubble chart
4
+ // {
5
+ // type: 'bubble',
6
+ // data: {
7
+ // datasets: [
8
+ // {
9
+ // label: 'Data 1',
10
+ // data: [
11
+ // { x: 1, y: 4, r: 9 },
12
+ // { x: 2, y: 4, r: 6 },
13
+ // { x: 3, y: 8, r: 30 },
14
+ // { x: 0, y: 10, r: 1 },
15
+ // { x: 10, y: 5, r: 5 },
16
+ // ],
17
+ // },
18
+ // ],
19
+ // },
20
+ // }
21
+ const bubbleDataPointSchema = z.object({
22
+ x: z.number(),
23
+ y: z.number(),
24
+ r: z.number().describe("Radius of the bubble"),
25
+ });
26
+ const schema = {
27
+ type: z.literal("bubble").default("bubble"),
28
+ data: z.object({
29
+ datasets: z.array(z.object({
30
+ label: z.string().describe("Label for the dataset"),
31
+ data: z.array(bubbleDataPointSchema).describe("Array of {x, y, r} bubble points"),
32
+ backgroundColor: z.string().optional().describe("Background color of the bubbles"),
33
+ borderColor: z.string().optional().describe("Border color of the bubbles"),
34
+ borderWidth: z.number().optional().describe("Width of the bubble borders"),
35
+ hoverBackgroundColor: z.string().optional().describe("Background color when hovering"),
36
+ hoverBorderColor: z.string().optional().describe("Border color when hovering"),
37
+ hoverBorderWidth: z.number().optional().describe("Border width when hovering"),
38
+ hoverRadius: z.number().optional().describe("Radius when hovering"),
39
+ })),
40
+ }),
41
+ };
42
+ const tool = {
43
+ name: "bubble",
44
+ description: `Generates a bubble chart with the provided data points.
45
+ example input:
46
+ \`\`\`json
47
+ {
48
+ "type": "bubble",
49
+ "data": {
50
+ "datasets": [
51
+ {
52
+ "label": "Data 1",
53
+ "data": [
54
+ {"x": 1, "y": 4, "r": 9},
55
+ {"x": 2, "y": 4, "r": 6},
56
+ {"x": 3, "y": 8, "r": 30},
57
+ {"x": 0, "y": 10, "r": 1},
58
+ {"x": 10, "y": 5, "r": 5}
59
+ ]
60
+ }
61
+ ]
62
+ }
63
+ }
64
+ \`\`\`
65
+ `,
66
+ inputSchema: zodToJsonSchema(schema),
67
+ };
68
+ export const bubble = {
69
+ schema,
70
+ tool,
71
+ };
@@ -0,0 +1,104 @@
1
+ import { z } from "zod";
2
+ import { zodToJsonSchema } from "../utils/index.js";
3
+ // Define the schema for the doughnut chart
4
+ // {
5
+ // type: 'doughnut',
6
+ // data: {
7
+ // labels: ['January', 'February', 'March', 'April', 'May'],
8
+ // datasets: [{ data: [50, 60, 70, 180, 190] }],
9
+ // },
10
+ // options: {
11
+ // plugins: {
12
+ // doughnutlabel: {
13
+ // labels: [{ text: '550', font: { size: 20 } }, { text: 'total' }],
14
+ // },
15
+ // },
16
+ // },
17
+ // }
18
+ const fontSchema = z.object({
19
+ size: z.number().optional(),
20
+ weight: z.string().optional(),
21
+ });
22
+ const doughnutLabelItemSchema = z.object({
23
+ text: z.string(),
24
+ font: fontSchema.optional(),
25
+ color: z.string().optional(),
26
+ });
27
+ const datalabelsSchema = z.object({
28
+ color: z.string().optional(),
29
+ anchor: z.string().optional(),
30
+ align: z.string().optional(),
31
+ formatter: z.function().optional(),
32
+ font: fontSchema.optional(),
33
+ });
34
+ const pluginsSchema = z.object({
35
+ doughnutlabel: z.object({
36
+ labels: z.array(doughnutLabelItemSchema).optional(),
37
+ }).optional(),
38
+ datalabels: datalabelsSchema.optional(),
39
+ });
40
+ const layoutSchema = z.object({
41
+ padding: z.number().optional(),
42
+ });
43
+ const legendSchema = z.object({
44
+ display: z.boolean().optional(),
45
+ });
46
+ const optionsSchema = z.object({
47
+ circumference: z.number().optional(),
48
+ rotation: z.number().optional(),
49
+ cutoutPercentage: z.number().optional(),
50
+ layout: layoutSchema.optional(),
51
+ legend: legendSchema.optional(),
52
+ plugins: pluginsSchema.optional(),
53
+ });
54
+ const schema = {
55
+ type: z.literal("doughnut").default("doughnut"),
56
+ data: z.object({
57
+ labels: z.array(z.string()).describe("Labels for each doughnut slice"),
58
+ datasets: z.array(z.object({
59
+ data: z.array(z.number()).describe("Data values for each slice"),
60
+ label: z.string().optional().describe("Label for the dataset"),
61
+ backgroundColor: z.union([z.string(), z.array(z.string())]).optional().describe("Background colors for slices"),
62
+ borderColor: z.union([z.string(), z.array(z.string())]).optional().describe("Border colors for slices"),
63
+ borderWidth: z.number().optional().describe("Width of the slice borders"),
64
+ hoverBackgroundColor: z.array(z.string()).optional().describe("Background colors when hovering"),
65
+ hoverBorderColor: z.array(z.string()).optional().describe("Border colors when hovering"),
66
+ hoverBorderWidth: z.number().optional().describe("Border width when hovering"),
67
+ })),
68
+ }),
69
+ options: optionsSchema.optional(),
70
+ };
71
+ const tool = {
72
+ name: "doughnut",
73
+ description: `Generates a doughnut chart with the provided data.
74
+ example input:
75
+ \`\`\`json
76
+ {
77
+ "type": "doughnut",
78
+ "data": {
79
+ "labels": ["January", "February", "March", "April", "May"],
80
+ "datasets": [
81
+ {
82
+ "data": [50, 60, 70, 180, 190]
83
+ }
84
+ ]
85
+ },
86
+ "options": {
87
+ "plugins": {
88
+ "doughnutlabel": {
89
+ "labels": [
90
+ {"text": "550", "font": {"size": 20}},
91
+ {"text": "total"}
92
+ ]
93
+ }
94
+ }
95
+ }
96
+ }
97
+ \`\`\`
98
+ `,
99
+ inputSchema: zodToJsonSchema(schema),
100
+ };
101
+ export const doughnut = {
102
+ schema,
103
+ tool,
104
+ };
@@ -0,0 +1,84 @@
1
+ import { z } from "zod";
2
+ import { zodToJsonSchema } from "../utils/index.js";
3
+ // Define the schema for the gauge chart
4
+ // {
5
+ // type: 'gauge',
6
+ // data: {
7
+ // datasets: [
8
+ // {
9
+ // value: 50,
10
+ // data: [20, 40, 60],
11
+ // backgroundColor: ['green', 'orange', 'red'],
12
+ // borderWidth: 2,
13
+ // },
14
+ // ],
15
+ // },
16
+ // options: {
17
+ // valueLabel: {
18
+ // fontSize: 22,
19
+ // backgroundColor: 'transparent',
20
+ // color: '#000',
21
+ // formatter: function (value, context) {
22
+ // return value + ' mph';
23
+ // },
24
+ // bottomMarginPercentage: 10,
25
+ // },
26
+ // },
27
+ // }
28
+ const valueLabelSchema = z.object({
29
+ fontSize: z.number().optional(),
30
+ backgroundColor: z.string().optional(),
31
+ color: z.string().optional(),
32
+ formatter: z.function().optional(),
33
+ bottomMarginPercentage: z.number().optional(),
34
+ });
35
+ const optionsSchema = z.object({
36
+ valueLabel: valueLabelSchema.optional(),
37
+ });
38
+ const schema = {
39
+ type: z.literal("gauge").default("gauge"),
40
+ data: z.object({
41
+ datasets: z.array(z.object({
42
+ value: z.number().describe("Current value of the gauge"),
43
+ data: z.array(z.number()).describe("Threshold values for different sections"),
44
+ backgroundColor: z.array(z.string()).describe("Background colors for each section"),
45
+ borderWidth: z.number().optional().describe("Width of the gauge border"),
46
+ label: z.string().optional().describe("Label for the dataset"),
47
+ })),
48
+ }),
49
+ options: optionsSchema.optional(),
50
+ };
51
+ const tool = {
52
+ name: "gauge",
53
+ description: `Generates a gauge chart with the provided value and thresholds.
54
+ example input:
55
+ \`\`\`json
56
+ {
57
+ "type": "gauge",
58
+ "data": {
59
+ "datasets": [
60
+ {
61
+ "value": 50,
62
+ "data": [20, 40, 60],
63
+ "backgroundColor": ["green", "orange", "red"],
64
+ "borderWidth": 2
65
+ }
66
+ ]
67
+ },
68
+ "options": {
69
+ "valueLabel": {
70
+ "fontSize": 22,
71
+ "backgroundColor": "transparent",
72
+ "color": "#000",
73
+ "bottomMarginPercentage": 10
74
+ }
75
+ }
76
+ }
77
+ \`\`\`
78
+ `,
79
+ inputSchema: zodToJsonSchema(schema),
80
+ };
81
+ export const gauge = {
82
+ schema,
83
+ tool,
84
+ };
@@ -0,0 +1,15 @@
1
+ export { bar } from "./bar.js";
2
+ export { bubble } from "./bubble.js";
3
+ export { doughnut } from "./doughnut.js";
4
+ export { gauge } from "./gauge.js";
5
+ export { line } from "./line.js";
6
+ export { ohlc } from "./ohlc.js";
7
+ export { pie } from "./pie.js";
8
+ export { polarArea } from "./polarArea.js";
9
+ export { progressBar } from "./progressBar.js";
10
+ export { radar } from "./radar.js";
11
+ export { radialGauge } from "./radialGauge.js";
12
+ export { sankey } from "./sankey.js";
13
+ export { scatter } from "./scatter.js";
14
+ export { sparkline } from "./sparkline.js";
15
+ export { violin } from "./violin.js";