@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
@@ -0,0 +1,474 @@
1
+ import { z } from "zod";
2
+ import { zodToJsonSchema } from "../utils/index.js";
3
+
4
+ // Define the schema for the bar chart
5
+ // {
6
+ // type: 'ohlc',
7
+ // data: {
8
+ // datasets: [
9
+ // {
10
+ // label: 'MSFT',
11
+ // yAxisID: 'y1',
12
+ // data: [
13
+ // ['2016-04-01', 18.23, 19.36, 18.18, 19.31],
14
+ // ['2016-04-02', 19.50, 19.89, 19.00, 19.29],
15
+ // ['2016-04-03', 19.13, 19.15, 18.43, 18.75],
16
+ // ['2016-04-06', 18.54, 18.76, 18.27, 18.76],
17
+ // ['2016-04-07', 18.76, 19.14, 18.63, 18.76],
18
+ // ['2016-04-08', 18.97, 19.62, 18.96, 19.19],
19
+ // ['2016-04-09', 19.45, 19.70, 19.22, 19.67],
20
+ // ['2016-04-13', 19.69, 19.85, 19.37, 19.59],
21
+ // ['2016-04-14', 19.44, 19.55, 19.00, 19.35],
22
+ // ['2016-04-15', 19.21, 19.25, 18.51, 18.83],
23
+ // ['2016-04-16', 19.16, 19.78, 18.99, 19.76],
24
+ // ['2016-04-17', 19.69, 19.69, 19.00, 19.20],
25
+ // ['2016-04-20', 18.89, 18.95, 18.57, 18.61],
26
+ // ['2016-04-21', 18.59, 19.08, 18.57, 18.97],
27
+ // ['2016-04-22', 18.76, 19.19, 18.70, 18.78],
28
+ // ['2016-04-23', 18.92, 18.94, 18.47, 18.92],
29
+ // ['2016-04-24', 19.82, 21.20, 19.50, 20.91],
30
+ // ['2016-04-27', 20.55, 20.82, 20.28, 20.40],
31
+ // ['2016-04-28', 20.25, 20.27, 19.79, 19.93],
32
+ // ['2016-04-29', 20.11, 20.89, 20.06, 20.25],
33
+ // ['2016-04-30', 20.60, 21.10, 20.01, 20.26],
34
+ // ['2016-05-01', 20.19, 20.35, 19.86, 20.24],
35
+ // ['2016-05-04', 20.37, 20.40, 19.98, 20.19],
36
+ // ['2016-05-05', 20.14, 20.24, 19.64, 19.79],
37
+ // ['2016-05-06', 20.06, 20.07, 19.61, 19.79],
38
+ // ['2016-05-07', 19.96, 19.99, 19.14, 19.32],
39
+ // ['2016-05-08', 19.46, 19.64, 19.14, 19.42],
40
+ // ['2016-05-11', 19.20, 19.73, 19.01, 19.32],
41
+ // ['2016-05-12', 19.51, 20.06, 19.47, 19.89],
42
+ // ['2016-05-13', 19.92, 20.00, 19.67, 19.75],
43
+ // ['2016-05-14', 19.83, 20.23, 19.80, 20.06],
44
+ // ['2016-05-15', 20.13, 20.50, 19.98, 20.22],
45
+ // ['2016-05-18', 20.36, 20.60, 20.24, 20.60],
46
+ // ['2016-05-19', 20.51, 20.74, 20.25, 20.31],
47
+ // ['2016-05-20', 20.41, 20.69, 20.22, 20.38],
48
+ // ['2016-05-21', 20.14, 20.23, 19.51, 19.82],
49
+ // ['2016-05-22', 19.93, 20.17, 19.47, 19.75],
50
+ // ['2016-05-26', 19.54, 20.45, 19.45, 20.34],
51
+ // ['2016-05-27', 20.25, 20.60, 20.07, 20.13],
52
+ // ['2016-05-28', 20.32, 20.63, 20.05, 20.45],
53
+ // ['2016-05-29', 20.56, 20.94, 20.30, 20.89],
54
+ // ['2016-06-01', 21.00, 21.50, 20.86, 21.40],
55
+ // ['2016-06-02', 21.36, 21.98, 21.20, 21.40],
56
+ // ['2016-06-03', 21.31, 21.76, 21.29, 21.73],
57
+ // ['2016-06-04', 21.77, 21.90, 21.58, 21.83],
58
+ // ['2016-06-05', 21.96, 22.31, 21.81, 22.14],
59
+ // ['2016-06-08', 21.98, 22.32, 21.63, 22.05],
60
+ // ['2016-06-09', 22.06, 22.32, 21.88, 22.08],
61
+ // ['2016-06-10', 22.17, 22.62, 22.12, 22.55],
62
+ // ['2016-06-11', 22.59, 23.26, 22.57, 22.83],
63
+ // ['2016-06-12', 22.90, 23.38, 22.74, 23.33],
64
+ // ['2016-06-15', 23.23, 23.54, 23.02, 23.42],
65
+ // ['2016-06-16', 23.47, 24.11, 23.44, 23.45],
66
+ // ['2016-06-17', 23.50, 23.82, 23.17, 23.68],
67
+ // ['2016-06-18', 23.62, 23.69, 23.30, 23.50],
68
+ // ['2016-06-19', 24.04, 24.34, 23.75, 24.07],
69
+ // ['2016-06-22', 23.95, 23.95, 23.25, 23.28],
70
+ // ['2016-06-23', 23.38, 23.66, 23.21, 23.34],
71
+ // ['2016-06-24', 23.45, 23.75, 23.36, 23.47],
72
+ // ['2016-06-25', 23.43, 23.92, 23.20, 23.79],
73
+ // ['2016-06-26', 23.57, 23.69, 23.32, 23.35],
74
+ // ].map(([d,o,h,l,c]) => ({x:new Date(d).getTime(),o,h,l,c})),
75
+ // color: {
76
+ // up: '#aaa',
77
+ // down: '#000',
78
+ // unchanged: '#ccc',
79
+ // },
80
+ // },
81
+ // {
82
+ // type: 'bar',
83
+ // yAxisID: 'y2',
84
+ // backgroundColor: '#bbb',
85
+ // label: 'Volume',
86
+ // data: [
87
+ // ['2016-04-01', 18],
88
+ // ['2016-04-02', 18],
89
+ // ['2016-04-03', 18],
90
+ // ['2016-04-06', 20],
91
+ // ['2016-04-07', 22],
92
+ // ['2016-04-08', 24],
93
+ // ['2016-04-09', 22],
94
+ // ['2016-04-13', 20],
95
+ // ['2016-04-14', 21],
96
+ // ['2016-04-15', 19],
97
+ // ['2016-04-16', 21],
98
+ // ['2016-04-17', 18],
99
+ // ['2016-04-20', 16],
100
+ // ['2016-04-21', 19],
101
+ // ['2016-04-22', 16],
102
+ // ['2016-04-23', 19],
103
+ // ['2016-04-24', 23],
104
+ // ['2016-04-27', 25],
105
+ // ['2016-04-28', 27],
106
+ // ['2016-04-29', 22],
107
+ // ['2016-04-30', 21],
108
+ // ['2016-05-01', 21],
109
+ // ['2016-05-04', 21],
110
+ // ['2016-05-05', 17],
111
+ // ['2016-05-06', 21],
112
+ // ['2016-05-07', 15],
113
+ // ['2016-05-08', 22],
114
+ // ['2016-05-11', 17],
115
+ // ['2016-05-12', 19],
116
+ // ['2016-05-13', 24],
117
+ // ['2016-05-14', 22],
118
+ // ['2016-05-15', 22],
119
+ // ['2016-05-18', 25],
120
+ // ['2016-05-19', 16],
121
+ // ['2016-05-20', 20],
122
+ // ['2016-05-21', 18],
123
+ // ['2016-05-22', 22],
124
+ // ['2016-05-26', 18],
125
+ // ['2016-05-27', 25],
126
+ // ['2016-05-28', 23],
127
+ // ['2016-05-29', 24],
128
+ // ['2016-06-01', 24],
129
+ // ['2016-06-02', 22],
130
+ // ['2016-06-03', 22],
131
+ // ['2016-06-04', 22],
132
+ // ['2016-06-05', 20],
133
+ // ['2016-06-08', 20],
134
+ // ['2016-06-09', 20],
135
+ // ['2016-06-10', 19],
136
+ // ['2016-06-11', 22],
137
+ // ['2016-06-12', 23],
138
+ // ['2016-06-15', 24],
139
+ // ['2016-06-16', 25],
140
+ // ['2016-06-17', 24],
141
+ // ['2016-06-18', 24],
142
+ // ['2016-06-19', 21],
143
+ // ['2016-06-22', 22],
144
+ // ['2016-06-23', 23],
145
+ // ['2016-06-24', 22],
146
+ // ['2016-06-25', 21],
147
+ // ['2016-06-26', 22],
148
+ // ].map(([d,y]) => ({x:new Date(d).getTime(),y})),
149
+ // },
150
+ // {
151
+ // type: 'line',
152
+ // yAxisID: 'y1',
153
+ // borderColor: '#f00',
154
+ // backgroundColor: '#f00',
155
+ // borderWidth: 2,
156
+ // pointRadius: 0,
157
+ // label: 'SMA',
158
+ // data: [
159
+ // ['2016-04-01', 18.832],
160
+ // ['2016-04-02', 18.98],
161
+ // ['2016-04-03', 18.97],
162
+ // ['2016-04-06', 19.082],
163
+ // ['2016-04-07', 19.262],
164
+ // ['2016-04-08', 19.352],
165
+ // ['2016-04-09', 19.39],
166
+ // ['2016-04-13', 19.438],
167
+ // ['2016-04-14', 19.278],
168
+ // ['2016-04-15', 19.108],
169
+ // ['2016-04-16', 19.018],
170
+ // ['2016-04-17', 18.97],
171
+ // ['2016-04-20', 18.996],
172
+ // ['2016-04-21', 19.328],
173
+ // ['2016-04-22', 19.66],
174
+ // ['2016-04-23', 19.93],
175
+ // ['2016-04-24', 20.266],
176
+ // ['2016-04-27', 20.34],
177
+ // ['2016-04-28', 20.304],
178
+ // ['2016-04-29', 20.282],
179
+ // ['2016-04-30', 20.272],
180
+ // ['2016-05-01', 20.144],
181
+ // ['2016-05-04', 19.998],
182
+ // ['2016-05-05', 19.764],
183
+ // ['2016-05-06', 19.638],
184
+ // ['2016-05-07', 19.61],
185
+ // ['2016-05-08', 19.584],
186
+ // ['2016-05-11', 19.718],
187
+ // ['2016-05-12', 19.95],
188
+ // ['2016-05-13', 20.15],
189
+ // ['2016-05-14', 20.248],
190
+ // ['2016-05-15', 20.31],
191
+ // ['2016-05-18', 20.27],
192
+ // ['2016-05-19', 20.106],
193
+ // ['2016-05-20', 20.054],
194
+ // ['2016-05-21', 20.036],
195
+ // ['2016-05-22', 20.12],
196
+ // ['2016-05-26', 20.334],
197
+ // ['2016-05-27', 20.698],
198
+ // ['2016-05-28', 20.91],
199
+ // ['2016-05-29', 21.2],
200
+ // ['2016-06-01', 21.48],
201
+ // ['2016-06-02', 21.676],
202
+ // ['2016-06-03', 21.816],
203
+ // ['2016-06-04', 21.988],
204
+ // ['2016-06-05', 22.152],
205
+ // ['2016-06-08', 22.34],
206
+ // ['2016-06-09', 22.59],
207
+ // ['2016-06-10', 22.872],
208
+ // ['2016-06-11', 23.138],
209
+ // ['2016-06-12', 23.344],
210
+ // ['2016-06-15', 23.572],
211
+ // ['2016-06-16', 23.716],
212
+ // ['2016-06-17', 23.698],
213
+ // ['2016-06-18', 23.688],
214
+ // ['2016-06-19', 23.65],
215
+ // ['2016-06-22', 23.556],
216
+ // ['2016-06-23', 23.486],
217
+ // ['2016-06-24', 23.604],
218
+ // ['2016-06-25', 23.724],
219
+ // ['2016-06-26', 23.79],
220
+ // ].map(([d,y]) => ({x:new Date(d).getTime(),y})),
221
+ // },
222
+ // ],
223
+ // },
224
+ // options: {
225
+ // scales:{
226
+ // x:{
227
+ // adapters: {
228
+ // date: {
229
+ // zone: 'UTC-4'
230
+ // }
231
+ // },
232
+ // time: {
233
+ // unit: 'day',
234
+ // stepSize: 1,
235
+ // displayFormats: {
236
+ // day: 'MMM d',
237
+ // month: 'MMM d',
238
+ // }
239
+ // },
240
+ // },
241
+ // y1: {
242
+ // stack: 'stockChart',
243
+ // stackWeight: 10,
244
+ // weight: 2,
245
+ // },
246
+ // y2: {
247
+ // display: false,
248
+ // stack: 'stockChart',
249
+ // stackWeight: 1,
250
+ // weight: 1,
251
+ // },
252
+ // },
253
+ // plugins: {
254
+ // legend: {
255
+ // display: false,
256
+ // },
257
+ // title: {
258
+ // display: true,
259
+ // text: 'MSFT',
260
+ // font: {
261
+ // size: 20,
262
+ // },
263
+ // },
264
+ // },
265
+ // },
266
+ // }
267
+ const ohlcDataPointSchema = z.object({
268
+ x: z.number(), // timestamp
269
+ o: z.number(), // open
270
+ h: z.number(), // high
271
+ l: z.number(), // low
272
+ c: z.number(), // close
273
+ });
274
+
275
+ const barDataPointSchema = z.object({
276
+ x: z.number(), // timestamp
277
+ y: z.number(), // value
278
+ });
279
+
280
+ const lineDataPointSchema = z.object({
281
+ x: z.number(), // timestamp
282
+ y: z.number(), // value
283
+ });
284
+
285
+ const colorSchema = z.object({
286
+ up: z.string().optional(),
287
+ down: z.string().optional(),
288
+ unchanged: z.string().optional(),
289
+ });
290
+
291
+ const ohlcDatasetSchema = z.object({
292
+ label: z.string(),
293
+ yAxisID: z.string().optional(),
294
+ data: z.array(ohlcDataPointSchema),
295
+ color: colorSchema.optional(),
296
+ });
297
+
298
+ const barDatasetSchema = z.object({
299
+ type: z.literal("bar"),
300
+ yAxisID: z.string().optional(),
301
+ backgroundColor: z.string().optional(),
302
+ label: z.string(),
303
+ data: z.array(barDataPointSchema),
304
+ });
305
+
306
+ const lineDatasetSchema = z.object({
307
+ type: z.literal("line"),
308
+ yAxisID: z.string().optional(),
309
+ borderColor: z.string().optional(),
310
+ backgroundColor: z.string().optional(),
311
+ borderWidth: z.number().optional(),
312
+ pointRadius: z.number().optional(),
313
+ label: z.string(),
314
+ data: z.array(lineDataPointSchema),
315
+ });
316
+
317
+ const datasetSchema = z.union([
318
+ ohlcDatasetSchema,
319
+ barDatasetSchema,
320
+ lineDatasetSchema,
321
+ ]);
322
+
323
+ const dateAdapterSchema = z.object({
324
+ zone: z.string().optional(),
325
+ });
326
+
327
+ const timeConfigSchema = z.object({
328
+ unit: z.string().optional(),
329
+ stepSize: z.number().optional(),
330
+ displayFormats: z.record(z.string()).optional(),
331
+ });
332
+
333
+ const scaleSchema = z.object({
334
+ adapters: z.object({
335
+ date: dateAdapterSchema.optional(),
336
+ }).optional(),
337
+ time: timeConfigSchema.optional(),
338
+ stack: z.string().optional(),
339
+ stackWeight: z.number().optional(),
340
+ weight: z.number().optional(),
341
+ display: z.boolean().optional(),
342
+ });
343
+
344
+ const legendSchema = z.object({
345
+ display: z.boolean().optional(),
346
+ });
347
+
348
+ const titleSchema = z.object({
349
+ display: z.boolean().optional(),
350
+ text: z.string().optional(),
351
+ font: z.object({
352
+ size: z.number().optional(),
353
+ }).optional(),
354
+ });
355
+
356
+ const pluginsSchema = z.object({
357
+ legend: legendSchema.optional(),
358
+ title: titleSchema.optional(),
359
+ });
360
+
361
+ const scalesSchema = z.record(scaleSchema);
362
+
363
+ const optionsSchema = z.object({
364
+ scales: scalesSchema.optional(),
365
+ plugins: pluginsSchema.optional(),
366
+ });
367
+
368
+ const schema = {
369
+ type: z.literal("ohlc").default("ohlc"),
370
+ data: z.object({
371
+ datasets: z.array(datasetSchema),
372
+ }),
373
+ options: optionsSchema.optional(),
374
+ };
375
+
376
+ const tool = {
377
+ name: "ohlc",
378
+ description: `Generates an OHLC (Open, High, Low, Close) chart with the provided financial data.
379
+ example input:
380
+ \`\`\`json
381
+ {
382
+ "type": "ohlc",
383
+ "data": {
384
+ "datasets": [
385
+ {
386
+ "label": "MSFT",
387
+ "yAxisID": "y1",
388
+ "data": [
389
+ {"x": 1459468800000, "o": 18.23, "h": 19.36, "l": 18.18, "c": 19.31},
390
+ {"x": 1459555200000, "o": 19.50, "h": 19.89, "l": 19.00, "c": 19.29}
391
+ ],
392
+ "color": {
393
+ "up": "#aaa",
394
+ "down": "#000",
395
+ "unchanged": "#ccc"
396
+ }
397
+ },
398
+ {
399
+ "type": "bar",
400
+ "yAxisID": "y2",
401
+ "backgroundColor": "#bbb",
402
+ "label": "Volume",
403
+ "data": [
404
+ {"x": 1459468800000, "y": 18},
405
+ {"x": 1459555200000, "y": 18}
406
+ ]
407
+ },
408
+ {
409
+ "type": "line",
410
+ "yAxisID": "y1",
411
+ "borderColor": "#f00",
412
+ "backgroundColor": "#f00",
413
+ "borderWidth": 2,
414
+ "pointRadius": 0,
415
+ "label": "SMA",
416
+ "data": [
417
+ {"x": 1459468800000, "y": 18.832},
418
+ {"x": 1459555200000, "y": 18.98}
419
+ ]
420
+ }
421
+ ]
422
+ },
423
+ "options": {
424
+ "scales": {
425
+ "x": {
426
+ "adapters": {
427
+ "date": {
428
+ "zone": "UTC-4"
429
+ }
430
+ },
431
+ "time": {
432
+ "unit": "day",
433
+ "stepSize": 1,
434
+ "displayFormats": {
435
+ "day": "MMM d",
436
+ "month": "MMM d"
437
+ }
438
+ }
439
+ },
440
+ "y1": {
441
+ "stack": "stockChart",
442
+ "stackWeight": 10,
443
+ "weight": 2
444
+ },
445
+ "y2": {
446
+ "display": false,
447
+ "stack": "stockChart",
448
+ "stackWeight": 1,
449
+ "weight": 1
450
+ }
451
+ },
452
+ "plugins": {
453
+ "legend": {
454
+ "display": false
455
+ },
456
+ "title": {
457
+ "display": true,
458
+ "text": "MSFT",
459
+ "font": {
460
+ "size": 20
461
+ }
462
+ }
463
+ }
464
+ }
465
+ }
466
+ \`\`\`
467
+ `,
468
+ inputSchema: zodToJsonSchema(schema),
469
+ };
470
+
471
+ export const ohlc = {
472
+ schema,
473
+ tool,
474
+ };
@@ -0,0 +1,56 @@
1
+ import { z } from "zod";
2
+ import { zodToJsonSchema } from "../utils/index.js";
3
+
4
+ // Define the schema for the pie chart
5
+ // {
6
+ // type: 'pie',
7
+ // data: {
8
+ // labels: ['January', 'February', 'March', 'April', 'May'],
9
+ // datasets: [{ data: [50, 60, 70, 180, 190] }],
10
+ // },
11
+ // }
12
+
13
+ const schema = {
14
+ type: z.literal("pie").default("pie"),
15
+ data: z.object({
16
+ labels: z.array(z.string()).describe("Labels for each pie slice"),
17
+ datasets: z.array(
18
+ z.object({
19
+ data: z.array(z.number()).describe("Data values for each pie slice"),
20
+ label: z.string().optional().describe("Label for the dataset"),
21
+ backgroundColor: z.array(z.string()).optional().describe("Background colors for each slice"),
22
+ borderColor: z.array(z.string()).optional().describe("Border colors for each slice"),
23
+ borderWidth: z.number().optional().describe("Width of the slice borders"),
24
+ hoverBackgroundColor: z.array(z.string()).optional().describe("Background colors when hovering"),
25
+ hoverBorderColor: z.array(z.string()).optional().describe("Border colors when hovering"),
26
+ hoverBorderWidth: z.number().optional().describe("Border width when hovering"),
27
+ })
28
+ ),
29
+ }),
30
+ };
31
+
32
+ const tool = {
33
+ name: "pie",
34
+ description: `Generates a pie chart with the provided data.
35
+ example input:
36
+ \`\`\`json
37
+ {
38
+ "type": "pie",
39
+ "data": {
40
+ "labels": ["January", "February", "March", "April", "May"],
41
+ "datasets": [
42
+ {
43
+ "data": [50, 60, 70, 180, 190]
44
+ }
45
+ ]
46
+ }
47
+ }
48
+ \`\`\`
49
+ `,
50
+ inputSchema: zodToJsonSchema(schema),
51
+ };
52
+
53
+ export const pie = {
54
+ schema,
55
+ tool,
56
+ };
@@ -0,0 +1,56 @@
1
+ import { z } from "zod";
2
+ import { zodToJsonSchema } from "../utils/index.js";
3
+
4
+ // Define the schema for the polar area chart
5
+ // {
6
+ // type: 'polarArea',
7
+ // data: {
8
+ // labels: ['January', 'February', 'March', 'April', 'May'],
9
+ // datasets: [{ data: [50, 60, 70, 180, 190] }],
10
+ // },
11
+ // }
12
+
13
+ const schema = {
14
+ type: z.literal("polarArea").default("polarArea"),
15
+ data: z.object({
16
+ labels: z.array(z.string()).describe("Labels for each polar area segment"),
17
+ datasets: z.array(
18
+ z.object({
19
+ data: z.array(z.number()).describe("Data values for each segment"),
20
+ label: z.string().optional().describe("Label for the dataset"),
21
+ backgroundColor: z.array(z.string()).optional().describe("Background colors for each segment"),
22
+ borderColor: z.array(z.string()).optional().describe("Border colors for each segment"),
23
+ borderWidth: z.number().optional().describe("Width of the segment borders"),
24
+ hoverBackgroundColor: z.array(z.string()).optional().describe("Background colors when hovering"),
25
+ hoverBorderColor: z.array(z.string()).optional().describe("Border colors when hovering"),
26
+ hoverBorderWidth: z.number().optional().describe("Border width when hovering"),
27
+ })
28
+ ),
29
+ }),
30
+ };
31
+
32
+ const tool = {
33
+ name: "polarArea",
34
+ description: `Generates a polar area chart with the provided data.
35
+ example input:
36
+ \`\`\`json
37
+ {
38
+ "type": "polarArea",
39
+ "data": {
40
+ "labels": ["January", "February", "March", "April", "May"],
41
+ "datasets": [
42
+ {
43
+ "data": [50, 60, 70, 180, 190]
44
+ }
45
+ ]
46
+ }
47
+ }
48
+ \`\`\`
49
+ `,
50
+ inputSchema: zodToJsonSchema(schema),
51
+ };
52
+
53
+ export const polarArea = {
54
+ schema,
55
+ tool,
56
+ };
@@ -0,0 +1,56 @@
1
+ import { z } from "zod";
2
+ import { zodToJsonSchema } from "../utils/index.js";
3
+
4
+ // Define the schema for the progress bar chart
5
+ // {
6
+ // type: 'progressBar',
7
+ // data: {
8
+ // datasets: [
9
+ // {
10
+ // data: [50],
11
+ // },
12
+ // ],
13
+ // },
14
+ // }
15
+
16
+ const schema = {
17
+ type: z.literal("progressBar").default("progressBar"),
18
+ data: z.object({
19
+ datasets: z.array(
20
+ z.object({
21
+ data: z.array(z.number()).describe("Progress value (typically 0-100)"),
22
+ backgroundColor: z.string().optional().describe("Background color of the progress bar"),
23
+ borderColor: z.string().optional().describe("Border color of the progress bar"),
24
+ borderWidth: z.number().optional().describe("Width of the progress bar border"),
25
+ label: z.string().optional().describe("Label for the dataset"),
26
+ barColor: z.string().optional().describe("Color of the progress bar fill"),
27
+ barBackgroundColor: z.string().optional().describe("Background color of the empty progress bar"),
28
+ })
29
+ ),
30
+ }),
31
+ };
32
+
33
+ const tool = {
34
+ name: "progressBar",
35
+ description: `Generates a progress bar chart with the provided value.
36
+ example input:
37
+ \`\`\`json
38
+ {
39
+ "type": "progressBar",
40
+ "data": {
41
+ "datasets": [
42
+ {
43
+ "data": [50]
44
+ }
45
+ ]
46
+ }
47
+ }
48
+ \`\`\`
49
+ `,
50
+ inputSchema: zodToJsonSchema(schema),
51
+ };
52
+
53
+ export const progressBar = {
54
+ schema,
55
+ tool,
56
+ };