@umengfe/mcp-server-chart 0.0.1

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 (85) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +273 -0
  3. package/build/charts/area.d.ts +51 -0
  4. package/build/charts/area.js +52 -0
  5. package/build/charts/bar.d.ts +49 -0
  6. package/build/charts/bar.js +53 -0
  7. package/build/charts/base.d.ts +34 -0
  8. package/build/charts/base.js +74 -0
  9. package/build/charts/boxplot.d.ts +47 -0
  10. package/build/charts/boxplot.js +45 -0
  11. package/build/charts/column.d.ts +49 -0
  12. package/build/charts/column.js +53 -0
  13. package/build/charts/district-map.d.ts +93 -0
  14. package/build/charts/district-map.js +85 -0
  15. package/build/charts/dual-axes.d.ts +47 -0
  16. package/build/charts/dual-axes.js +54 -0
  17. package/build/charts/fishbone-diagram.d.ts +28 -0
  18. package/build/charts/fishbone-diagram.js +55 -0
  19. package/build/charts/flow-diagram.d.ts +91 -0
  20. package/build/charts/flow-diagram.js +41 -0
  21. package/build/charts/funnel.d.ts +42 -0
  22. package/build/charts/funnel.js +37 -0
  23. package/build/charts/histogram.d.ts +36 -0
  24. package/build/charts/histogram.js +41 -0
  25. package/build/charts/index.d.ts +28 -0
  26. package/build/charts/index.js +56 -0
  27. package/build/charts/line.d.ts +50 -0
  28. package/build/charts/line.js +47 -0
  29. package/build/charts/liquid.d.ts +34 -0
  30. package/build/charts/liquid.js +42 -0
  31. package/build/charts/mind-map.d.ts +26 -0
  32. package/build/charts/mind-map.js +39 -0
  33. package/build/charts/network-graph.d.ts +91 -0
  34. package/build/charts/network-graph.js +41 -0
  35. package/build/charts/organization-chart.d.ts +114 -0
  36. package/build/charts/organization-chart.js +56 -0
  37. package/build/charts/path-map.d.ts +25 -0
  38. package/build/charts/path-map.js +25 -0
  39. package/build/charts/pie.d.ts +43 -0
  40. package/build/charts/pie.js +44 -0
  41. package/build/charts/pin-map.d.ts +35 -0
  42. package/build/charts/pin-map.js +34 -0
  43. package/build/charts/radar.d.ts +48 -0
  44. package/build/charts/radar.js +45 -0
  45. package/build/charts/sankey.d.ts +46 -0
  46. package/build/charts/sankey.js +43 -0
  47. package/build/charts/scatter.d.ts +47 -0
  48. package/build/charts/scatter.js +43 -0
  49. package/build/charts/treemap.d.ts +86 -0
  50. package/build/charts/treemap.js +55 -0
  51. package/build/charts/venn.d.ts +45 -0
  52. package/build/charts/venn.js +45 -0
  53. package/build/charts/violin.d.ts +47 -0
  54. package/build/charts/violin.js +45 -0
  55. package/build/charts/word-cloud.d.ts +42 -0
  56. package/build/charts/word-cloud.js +40 -0
  57. package/build/index.d.ts +2 -0
  58. package/build/index.js +73 -0
  59. package/build/sdk.d.ts +6 -0
  60. package/build/sdk.js +24 -0
  61. package/build/server.d.ts +17 -0
  62. package/build/server.js +132 -0
  63. package/build/services/index.d.ts +3 -0
  64. package/build/services/index.js +9 -0
  65. package/build/services/sse.d.ts +2 -0
  66. package/build/services/sse.js +58 -0
  67. package/build/services/stdio.d.ts +2 -0
  68. package/build/services/stdio.js +21 -0
  69. package/build/services/streamable.d.ts +2 -0
  70. package/build/services/streamable.js +58 -0
  71. package/build/utils/callTool.d.ts +18 -0
  72. package/build/utils/callTool.js +130 -0
  73. package/build/utils/env.d.ts +12 -0
  74. package/build/utils/env.js +32 -0
  75. package/build/utils/generate.d.ts +25 -0
  76. package/build/utils/generate.js +68 -0
  77. package/build/utils/index.d.ts +3 -0
  78. package/build/utils/index.js +9 -0
  79. package/build/utils/logger.d.ts +28 -0
  80. package/build/utils/logger.js +57 -0
  81. package/build/utils/schema.d.ts +7 -0
  82. package/build/utils/schema.js +14 -0
  83. package/build/utils/validator.d.ts +34 -0
  84. package/build/utils/validator.js +76 -0
  85. package/package.json +65 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 AntV Visualization Team
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,273 @@
1
+ # MCP Server Chart ![](https://badge.mcpx.dev?type=server "MCP Server") [![build](https://github.com/antvis/mcp-server-chart/actions/workflows/build.yml/badge.svg)](https://github.com/antvis/mcp-server-chart/actions/workflows/build.yml) [![npm Version](https://img.shields.io/npm/v/@antv/mcp-server-chart.svg)](https://www.npmjs.com/package/@antv/mcp-server-chart) [![smithery badge](https://smithery.ai/badge/@antvis/mcp-server-chart)](https://smithery.ai/server/@antvis/mcp-server-chart) [![npm License](https://img.shields.io/npm/l/@antv/mcp-server-chart.svg)](https://www.npmjs.com/package/@antv/mcp-server-chart) [![Trust Score](https://archestra.ai/mcp-catalog/api/badge/quality/antvis/mcp-server-chart)](https://archestra.ai/mcp-catalog/antvis__mcp-server-chart) [![codecov](https://codecov.io/gh/antvis/mcp-server-chart/graph/badge.svg?token=7R98VGO5GL)](https://codecov.io/gh/antvis/mcp-server-chart)
2
+
3
+ A Model Context Protocol server for generating charts using [AntV](https://github.com/antvis/). We can use this mcp server for _chart generation_ and _data analysis_.
4
+
5
+ <a href="https://www.star-history.com/#antvis/mcp-server-chart&Date">
6
+ <img width="512" src="https://api.star-history.com/svg?repos=antvis/mcp-server-chart&type=Date" />
7
+ </a>
8
+
9
+ This is a TypeScript-based MCP server that provides chart generation capabilities. It allows you to create various types of charts through MCP tools. You can also use it in [Dify](https://marketplace.dify.ai/plugins/antv/visualization).
10
+
11
+ ## 📋 Table of Contents
12
+
13
+ - [✨ Features](#-features)
14
+ - [🤖 Usage](#-usage)
15
+ - [🚰 Run with SSE or Streamable transport](#-run-with-sse-or-streamable-transport)
16
+ - [🎮 CLI Options](#-cli-options)
17
+ - [⚙️ Environment Variables](#%EF%B8%8F-environment-variables)
18
+ - [VIS_REQUEST_SERVER](#-private-deployment)
19
+ - [SERVICE_ID](#%EF%B8%8F-generate-records)
20
+ - [DISABLED_TOOLS](#%EF%B8%8F-tool-filtering)
21
+ - [📠 Private Deployment](#-private-deployment)
22
+ - [🗺️ Generate Records](#%EF%B8%8F-generate-records)
23
+ - [🎛️ Tool Filtering](#%EF%B8%8F-tool-filtering)
24
+ - [🔨 Development](#-development)
25
+ - [📄 License](#-license)
26
+
27
+ ## ✨ Features
28
+
29
+ Now 25+ charts supported.
30
+
31
+ <img width="768" alt="mcp-server-chart preview" src="https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*IyIRQIQHyKYAAAAAgCAAAAgAemJ7AQ/fmt.avif" />
32
+
33
+ 1. `generate_area_chart`: Generate an `area` chart, used to display the trend of data under a continuous independent variable, allowing observation of overall data trends.
34
+ 1. `generate_bar_chart`: Generate a `bar` chart, used to compare values across different categories, suitable for horizontal comparisons.
35
+ 1. `generate_boxplot_chart`: Generate a `boxplot`, used to display the distribution of data, including the median, quartiles, and outliers.
36
+ 1. `generate_column_chart`: Generate a `column` chart, used to compare values across different categories, suitable for vertical comparisons.
37
+ 1. `generate_district_map` - Generate a `district-map`, used to show administrative divisions and data distribution.
38
+ 1. `generate_dual_axes_chart`: Generate a `dual-axes` chart, used to display the relationship between two variables with different units or ranges.
39
+ 1. `generate_fishbone_diagram`: Generate a `fishbone` diagram, also known as an Ishikawa diagram, used to identify and display the root causes of a problem.
40
+ 1. `generate_flow_diagram`: Generate a `flowchart`, used to display the steps and sequence of a process.
41
+ 1. `generate_funnel_chart`: Generate a `funnel` chart, used to display data loss at different stages.
42
+ 1. `generate_histogram_chart`: Generate a `histogram`, used to display the distribution of data by dividing it into intervals and counting the number of data points in each interval.
43
+ 1. `generate_line_chart`: Generate a `line` chart, used to display the trend of data over time or another continuous variable.
44
+ 1. `generate_liquid_chart`: Generate a `liquid` chart, used to display the proportion of data, visually representing percentages in the form of water-filled spheres.
45
+ 1. `generate_mind_map`: Generate a `mind-map`, used to display thought processes and hierarchical information.
46
+ 1. `generate_network_graph`: Generate a `network` graph, used to display relationships and connections between nodes.
47
+ 1. `generate_organization_chart`: Generate an `organizational` chart, used to display the structure of an organization and personnel relationships.
48
+ 1. `generate_path_map` - Generate a `path-map`, used to display route planning results for POIs.
49
+ 1. `generate_pie_chart`: Generate a `pie` chart, used to display the proportion of data, dividing it into parts represented by sectors showing the percentage of each part.
50
+ 1. `generate_pin_map` - Generate a `pin-map`, used to show the distribution of POIs.
51
+ 1. `generate_radar_chart`: Generate a `radar` chart, used to display multi-dimensional data comprehensively, showing multiple dimensions in a radar-like format.
52
+ 1. `generate_sankey_chart`: Generate a `sankey` chart, used to display data flow and volume, representing the movement of data between different nodes in a Sankey-style format.
53
+ 1. `generate_scatter_chart`: Generate a `scatter` plot, used to display the relationship between two variables, showing data points as scattered dots on a coordinate system.
54
+ 1. `generate_treemap_chart`: Generate a `treemap`, used to display hierarchical data, showing data in rectangular forms where the size of rectangles represents the value of the data.
55
+ 1. `generate_venn_chart`: Generate a `venn` diagram, used to display relationships between sets, including intersections, unions, and differences.
56
+ 1. `generate_violin_chart`: Generate a `violin` plot, used to display the distribution of data, combining features of boxplots and density plots to provide a more detailed view of the data distribution.
57
+ 1. `generate_word_cloud_chart`: Generate a `word-cloud`, used to display the frequency of words in textual data, with font sizes indicating the frequency of each word.
58
+
59
+ > [!NOTE]
60
+ > The above geographic visualization chart generation tool uses [AMap service](https://lbs.amap.com/) and currently only supports map generation within China.
61
+
62
+ ## 🤖 Usage
63
+
64
+ To use with `Desktop APP`, such as Claude, VSCode, [Cline](https://cline.bot/mcp-marketplace), Cherry Studio, Cursor, and so on, add the MCP server config below. On Mac system:
65
+
66
+ ```json
67
+ {
68
+ "mcpServers": {
69
+ "mcp-server-chart": {
70
+ "command": "npx",
71
+ "args": ["-y", "@antv/mcp-server-chart"]
72
+ }
73
+ }
74
+ }
75
+ ```
76
+
77
+ On Window system:
78
+
79
+ ```json
80
+ {
81
+ "mcpServers": {
82
+ "mcp-server-chart": {
83
+ "command": "cmd",
84
+ "args": ["/c", "npx", "-y", "@antv/mcp-server-chart"]
85
+ }
86
+ }
87
+ }
88
+ ```
89
+
90
+ Also, you can use it on [aliyun](https://bailian.console.aliyun.com/?tab=mcp#/mcp-market/detail/antv-visualization-chart), [modelscope](https://www.modelscope.cn/mcp/servers/@antvis/mcp-server-chart), [glama.ai](https://glama.ai/mcp/servers/@antvis/mcp-server-chart), [smithery.ai](https://smithery.ai/server/@antvis/mcp-server-chart) or others with HTTP, SSE Protocol.
91
+
92
+ ## 🚰 Run with SSE or Streamable transport
93
+
94
+ ### Run directly
95
+
96
+ Install the package globally.
97
+
98
+ ```bash
99
+ npm install -g @antv/mcp-server-chart
100
+ ```
101
+
102
+ Run the server with your preferred transport option:
103
+
104
+ ```bash
105
+ # For SSE transport (default endpoint: /sse)
106
+ mcp-server-chart --transport sse
107
+
108
+ # For Streamable transport with custom endpoint
109
+ mcp-server-chart --transport streamable
110
+ ```
111
+
112
+ Then you can access the server at:
113
+
114
+ - SSE transport: `http://localhost:1122/sse`
115
+ - Streamable transport: `http://localhost:1122/mcp`
116
+
117
+ ### Docker deploy
118
+
119
+ Enter the docker directory.
120
+
121
+ ```bash
122
+ cd docker
123
+ ```
124
+
125
+ Deploy using docker-compose.
126
+
127
+ ```bash
128
+ docker compose up -d
129
+ ```
130
+
131
+ Then you can access the server at:
132
+
133
+ - SSE transport: `http://localhost:1123/sse`
134
+ - Streamable transport: `http://localhost:1122/mcp`
135
+
136
+ ## 🎮 CLI Options
137
+
138
+ You can also use the following CLI options when running the MCP server. Command options by run cli with `-H`.
139
+
140
+ ```plain
141
+ MCP Server Chart CLI
142
+
143
+ Options:
144
+ --transport, -t Specify the transport protocol: "stdio", "sse", or "streamable" (default: "stdio")
145
+ --host, -h Specify the host for SSE or streamable transport (default: localhost)
146
+ --port, -p Specify the port for SSE or streamable transport (default: 1122)
147
+ --endpoint, -e Specify the endpoint for the transport:
148
+ - For SSE: default is "/sse"
149
+ - For streamable: default is "/mcp"
150
+ --help, -H Show this help message
151
+ ```
152
+
153
+ ## ⚙️ Environment Variables
154
+
155
+ | Variable | Description | Default | Example |
156
+ | -------------------- | :--------------------------------------------------------- | -------------------------------------------- | --------------------------------------------- |
157
+ | `VIS_REQUEST_SERVER` | Custom chart generation service URL for private deployment | `https://antv-studio.alipay.com/api/gpt-vis` | `https://your-server.com/api/chart` |
158
+ | `SERVICE_ID` | Service identifier for chart generation records | - | `your-service-id-123` |
159
+ | `DISABLED_TOOLS` | Comma-separated list of tool names to disable | - | `generate_fishbone_diagram,generate_mind_map` |
160
+
161
+ ### 📠 Private Deployment
162
+
163
+ `MCP Server Chart` provides a free chart generation service by default. For users with a need for private deployment, they can try using `VIS_REQUEST_SERVER` to customize their own chart generation service.
164
+
165
+ ```json
166
+ {
167
+ "mcpServers": {
168
+ "mcp-server-chart": {
169
+ "command": "npx",
170
+ "args": ["-y", "@antv/mcp-server-chart"],
171
+ "env": {
172
+ "VIS_REQUEST_SERVER": "<YOUR_VIS_REQUEST_SERVER>"
173
+ }
174
+ }
175
+ }
176
+ }
177
+ ```
178
+
179
+ You can use AntV's project [GPT-Vis-SSR](https://github.com/antvis/GPT-Vis/tree/main/bindings/gpt-vis-ssr) to deploy an HTTP service in a private environment, and then pass the URL address through env `VIS_REQUEST_SERVER`.
180
+
181
+ - **Method**: `POST`
182
+ - **Parameter**: Which will be passed to `GPT-Vis-SSR` for rendering. Such as, `{ "type": "line", "data": [{ "time": "2025-05", "value": 512 }, { "time": "2025-06", "value": 1024 }] }`.
183
+ - **Return**: The return object of HTTP service.
184
+ - **success**: `boolean` Whether generate chart image successfully.
185
+ - **resultObj**: `string` The chart image url.
186
+ - **errorMessage**: `string` When `success = false`, return the error message.
187
+
188
+ > [!NOTE]
189
+ > The private deployment solution currently does not support geographic visualization chart generation include 3 tools: `geographic-district-map`, `geographic-path-map`, `geographic-pin-map`.
190
+
191
+ ### 🗺️ Generate Records
192
+
193
+ By default, users are required to save the results themselves, but we also provide a service for viewing the chart generation records, which requires users to generate a service identifier for themselves and configure it.
194
+
195
+ Use Alipay to scan and open the mini program to generate a personal service identifier (click the "My" menu below, enter the "My Services" page, click the "Generate" button, and click the "Copy" button after success):
196
+
197
+ <img alt="my service identifier website" width="240" src="https://mdn.alipayobjects.com/huamei_dxq8v0/afts/img/dASoTLt6EywAAAAARqAAAAgADu43AQFr/fmt.webp" />
198
+
199
+ Next, you need to add the `SERVICE_ID` environment variable to the MCP server configuration. For example, the configuration for Mac is as follows (for Windows systems, just add the `env` variable):
200
+
201
+ ```json
202
+ {
203
+ "mcpServers": {
204
+ "AntV Map": {
205
+ "command": "npx",
206
+ "args": ["-y", "@antv/mcp-server-chart"],
207
+ "env": {
208
+ "SERVICE_ID": "***********************************"
209
+ }
210
+ }
211
+ }
212
+ }
213
+ ```
214
+
215
+ After updating the MCP Server configuration, you need to restart your AI client application and check again whether you have started and connected to the MCP Server successfully. Then you can try to generate the map again. After the generation is successful, you can go to the "My Map" page of the mini program to view your map generation records.
216
+
217
+ <img alt="my map records website" width="240" src="https://mdn.alipayobjects.com/huamei_dxq8v0/afts/img/RacFR7emR3QAAAAAUkAAAAgADu43AQFr/original" />
218
+
219
+ ### 🎛️ Tool Filtering
220
+
221
+ You can disable specific chart generation tools using the `DISABLED_TOOLS` environment variable. This is useful when certain tools have compatibility issues with your MCP client or when you want to limit the available functionality.
222
+
223
+ ```json
224
+ {
225
+ "mcpServers": {
226
+ "mcp-server-chart": {
227
+ "command": "npx",
228
+ "args": ["-y", "@antv/mcp-server-chart"],
229
+ "env": {
230
+ "DISABLED_TOOLS": "generate_fishbone_diagram,generate_mind_map"
231
+ }
232
+ }
233
+ }
234
+ }
235
+ ```
236
+
237
+ **Available tool names for filtering** See the [✨ Features](#-features).
238
+
239
+ ## 🔨 Development
240
+
241
+ Install dependencies:
242
+
243
+ ```bash
244
+ npm install
245
+ ```
246
+
247
+ Build the server:
248
+
249
+ ```bash
250
+ npm run build
251
+ ```
252
+
253
+ Start the MCP server:
254
+
255
+ ```bash
256
+ npm run start
257
+ ```
258
+
259
+ Start the MCP server with SSE transport:
260
+
261
+ ```bash
262
+ node build/index.js -t sse
263
+ ```
264
+
265
+ Start the MCP server with Streamable transport:
266
+
267
+ ```bash
268
+ node build/index.js -t streamable
269
+ ```
270
+
271
+ ## 📄 License
272
+
273
+ MIT@[AntV](https://github.com/antvis).
@@ -0,0 +1,51 @@
1
+ import { z } from "zod";
2
+ export declare const area: {
3
+ schema: {
4
+ data: z.ZodArray<z.ZodObject<{
5
+ time: z.ZodString;
6
+ value: z.ZodNumber;
7
+ group: z.ZodOptional<z.ZodString>;
8
+ }, "strip", z.ZodTypeAny, {
9
+ time: string;
10
+ value: number;
11
+ group?: string | undefined;
12
+ }, {
13
+ time: string;
14
+ value: number;
15
+ group?: string | undefined;
16
+ }>, "atleastone">;
17
+ stack: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
18
+ style: z.ZodOptional<z.ZodObject<{
19
+ backgroundColor: z.ZodOptional<z.ZodString>;
20
+ palette: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
21
+ texture: z.ZodDefault<z.ZodOptional<z.ZodEnum<["default", "rough"]>>>;
22
+ lineWidth: z.ZodOptional<z.ZodNumber>;
23
+ }, "strip", z.ZodTypeAny, {
24
+ texture: "default" | "rough";
25
+ backgroundColor?: string | undefined;
26
+ palette?: string[] | undefined;
27
+ lineWidth?: number | undefined;
28
+ }, {
29
+ backgroundColor?: string | undefined;
30
+ palette?: string[] | undefined;
31
+ texture?: "default" | "rough" | undefined;
32
+ lineWidth?: number | undefined;
33
+ }>>;
34
+ theme: z.ZodDefault<z.ZodOptional<z.ZodEnum<["default", "academy", "dark"]>>>;
35
+ width: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
36
+ height: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
37
+ title: z.ZodDefault<z.ZodOptional<z.ZodString>>;
38
+ axisXTitle: z.ZodDefault<z.ZodOptional<z.ZodString>>;
39
+ axisYTitle: z.ZodDefault<z.ZodOptional<z.ZodString>>;
40
+ };
41
+ tool: {
42
+ name: string;
43
+ description: string;
44
+ inputSchema: import("zod-to-json-schema").JsonSchema7Type & {
45
+ $schema?: string | undefined;
46
+ definitions?: {
47
+ [key: string]: import("zod-to-json-schema").JsonSchema7Type;
48
+ } | undefined;
49
+ };
50
+ };
51
+ };
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.area = void 0;
4
+ const zod_1 = require("zod");
5
+ const utils_1 = require("../utils/index.js");
6
+ const base_1 = require("./base.js");
7
+ // Area chart data schema
8
+ const data = zod_1.z.object({
9
+ time: zod_1.z.string(),
10
+ value: zod_1.z.number(),
11
+ group: zod_1.z.string().optional(),
12
+ });
13
+ // Area chart input schema
14
+ const schema = {
15
+ data: zod_1.z
16
+ .array(data)
17
+ .describe("Data for area chart, such as, [{ time: '2018', value: 99.9 }].")
18
+ .nonempty({ message: "Area chart data cannot be empty." }),
19
+ stack: zod_1.z
20
+ .boolean()
21
+ .optional()
22
+ .default(false)
23
+ .describe("Whether stacking is enabled. When enabled, area charts require a 'group' field in the data."),
24
+ style: zod_1.z
25
+ .object({
26
+ backgroundColor: base_1.BackgroundColorSchema,
27
+ palette: base_1.PaletteSchema,
28
+ texture: base_1.TextureSchema,
29
+ lineWidth: zod_1.z
30
+ .number()
31
+ .optional()
32
+ .describe("Line width for the lines of chart, such as 4."),
33
+ })
34
+ .optional()
35
+ .describe("Style configuration for the chart with a JSON object, optional."),
36
+ theme: base_1.ThemeSchema,
37
+ width: base_1.WidthSchema,
38
+ height: base_1.HeightSchema,
39
+ title: base_1.TitleSchema,
40
+ axisXTitle: base_1.AxisXTitleSchema,
41
+ axisYTitle: base_1.AxisYTitleSchema,
42
+ };
43
+ // Area chart tool descriptor
44
+ const tool = {
45
+ name: "generate_area_chart",
46
+ description: "Generate a area chart to show data trends under continuous independent variables and observe the overall data trend, such as, displacement = velocity (average or instantaneous) × time: s = v × t. If the x-axis is time (t) and the y-axis is velocity (v) at each moment, an area chart allows you to observe the trend of velocity over time and infer the distance traveled by the area's size.",
47
+ inputSchema: (0, utils_1.zodToJsonSchema)(schema),
48
+ };
49
+ exports.area = {
50
+ schema,
51
+ tool,
52
+ };
@@ -0,0 +1,49 @@
1
+ import { z } from "zod";
2
+ export declare const bar: {
3
+ schema: {
4
+ data: z.ZodArray<z.ZodObject<{
5
+ category: z.ZodString;
6
+ value: z.ZodNumber;
7
+ group: z.ZodOptional<z.ZodString>;
8
+ }, "strip", z.ZodTypeAny, {
9
+ value: number;
10
+ category: string;
11
+ group?: string | undefined;
12
+ }, {
13
+ value: number;
14
+ category: string;
15
+ group?: string | undefined;
16
+ }>, "atleastone">;
17
+ group: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
18
+ stack: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
19
+ style: z.ZodOptional<z.ZodObject<{
20
+ backgroundColor: z.ZodOptional<z.ZodString>;
21
+ palette: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
22
+ texture: z.ZodDefault<z.ZodOptional<z.ZodEnum<["default", "rough"]>>>;
23
+ }, "strip", z.ZodTypeAny, {
24
+ texture: "default" | "rough";
25
+ backgroundColor?: string | undefined;
26
+ palette?: string[] | undefined;
27
+ }, {
28
+ backgroundColor?: string | undefined;
29
+ palette?: string[] | undefined;
30
+ texture?: "default" | "rough" | undefined;
31
+ }>>;
32
+ theme: z.ZodDefault<z.ZodOptional<z.ZodEnum<["default", "academy", "dark"]>>>;
33
+ width: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
34
+ height: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
35
+ title: z.ZodDefault<z.ZodOptional<z.ZodString>>;
36
+ axisXTitle: z.ZodDefault<z.ZodOptional<z.ZodString>>;
37
+ axisYTitle: z.ZodDefault<z.ZodOptional<z.ZodString>>;
38
+ };
39
+ tool: {
40
+ name: string;
41
+ description: string;
42
+ inputSchema: import("zod-to-json-schema").JsonSchema7Type & {
43
+ $schema?: string | undefined;
44
+ definitions?: {
45
+ [key: string]: import("zod-to-json-schema").JsonSchema7Type;
46
+ } | undefined;
47
+ };
48
+ };
49
+ };
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.bar = void 0;
4
+ const zod_1 = require("zod");
5
+ const utils_1 = require("../utils/index.js");
6
+ const base_1 = require("./base.js");
7
+ // Bar chart data schema
8
+ const data = zod_1.z.object({
9
+ category: zod_1.z.string(),
10
+ value: zod_1.z.number(),
11
+ group: zod_1.z.string().optional(),
12
+ });
13
+ // Bar chart input schema
14
+ const schema = {
15
+ data: zod_1.z
16
+ .array(data)
17
+ .describe("Data for bar chart, such as, [{ category: '分类一', value: 10 }, { category: '分类二', value: 20 }], when grouping or stacking is needed for bar, the data should contain a `group` field, such as, when [{ category: '北京', value: 825, group: '油车' }, { category: '北京', value: 1000, group: '电车' }].")
18
+ .nonempty({ message: "Bar chart data cannot be empty." }),
19
+ group: zod_1.z
20
+ .boolean()
21
+ .optional()
22
+ .default(false)
23
+ .describe("Whether grouping is enabled. When enabled, bar charts require a 'group' field in the data. When `group` is true, `stack` should be false."),
24
+ stack: zod_1.z
25
+ .boolean()
26
+ .optional()
27
+ .default(true)
28
+ .describe("Whether stacking is enabled. When enabled, bar charts require a 'group' field in the data. When `stack` is true, `group` should be false."),
29
+ style: zod_1.z
30
+ .object({
31
+ backgroundColor: base_1.BackgroundColorSchema,
32
+ palette: base_1.PaletteSchema,
33
+ texture: base_1.TextureSchema,
34
+ })
35
+ .optional()
36
+ .describe("Style configuration for the chart with a JSON object, optional."),
37
+ theme: base_1.ThemeSchema,
38
+ width: base_1.WidthSchema,
39
+ height: base_1.HeightSchema,
40
+ title: base_1.TitleSchema,
41
+ axisXTitle: base_1.AxisXTitleSchema,
42
+ axisYTitle: base_1.AxisYTitleSchema,
43
+ };
44
+ // Bar chart tool descriptor
45
+ const tool = {
46
+ name: "generate_bar_chart",
47
+ description: "Generate a horizontal bar chart to show data for numerical comparisons among different categories, such as, comparing categorical data and for horizontal comparisons.",
48
+ inputSchema: (0, utils_1.zodToJsonSchema)(schema),
49
+ };
50
+ exports.bar = {
51
+ schema,
52
+ tool,
53
+ };
@@ -0,0 +1,34 @@
1
+ import { z } from "zod";
2
+ export declare const ThemeSchema: z.ZodDefault<z.ZodOptional<z.ZodEnum<["default", "academy", "dark"]>>>;
3
+ export declare const BackgroundColorSchema: z.ZodOptional<z.ZodString>;
4
+ export declare const PaletteSchema: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
5
+ export declare const TextureSchema: z.ZodDefault<z.ZodOptional<z.ZodEnum<["default", "rough"]>>>;
6
+ export declare const WidthSchema: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
7
+ export declare const HeightSchema: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
8
+ export declare const TitleSchema: z.ZodDefault<z.ZodOptional<z.ZodString>>;
9
+ export declare const AxisXTitleSchema: z.ZodDefault<z.ZodOptional<z.ZodString>>;
10
+ export declare const AxisYTitleSchema: z.ZodDefault<z.ZodOptional<z.ZodString>>;
11
+ export declare const NodeSchema: z.ZodObject<{
12
+ name: z.ZodString;
13
+ }, "strip", z.ZodTypeAny, {
14
+ name: string;
15
+ }, {
16
+ name: string;
17
+ }>;
18
+ export declare const EdgeSchema: z.ZodObject<{
19
+ source: z.ZodString;
20
+ target: z.ZodString;
21
+ name: z.ZodDefault<z.ZodOptional<z.ZodString>>;
22
+ }, "strip", z.ZodTypeAny, {
23
+ name: string;
24
+ target: string;
25
+ source: string;
26
+ }, {
27
+ target: string;
28
+ source: string;
29
+ name?: string | undefined;
30
+ }>;
31
+ export declare const MapTitleSchema: z.ZodString;
32
+ export declare const MapWidthSchema: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
33
+ export declare const MapHeightSchema: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
34
+ export declare const POIsSchema: z.ZodArray<z.ZodString, "atleastone">;
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.POIsSchema = exports.MapHeightSchema = exports.MapWidthSchema = exports.MapTitleSchema = exports.EdgeSchema = exports.NodeSchema = exports.AxisYTitleSchema = exports.AxisXTitleSchema = exports.TitleSchema = exports.HeightSchema = exports.WidthSchema = exports.TextureSchema = exports.PaletteSchema = exports.BackgroundColorSchema = exports.ThemeSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ // Define Zod schemas for base configuration properties
6
+ exports.ThemeSchema = zod_1.z
7
+ .enum(["default", "academy", "dark"])
8
+ .optional()
9
+ .default("default")
10
+ .describe("Set the theme for the chart, optional, default is 'default'.");
11
+ exports.BackgroundColorSchema = zod_1.z
12
+ .string()
13
+ .optional()
14
+ .describe("Background color of the chart, such as, '#fff'.");
15
+ exports.PaletteSchema = zod_1.z
16
+ .array(zod_1.z.string())
17
+ .optional()
18
+ .describe("Color palette for the chart, it is a collection of colors.");
19
+ exports.TextureSchema = zod_1.z
20
+ .enum(["default", "rough"])
21
+ .optional()
22
+ .default("default")
23
+ .describe("Set the texture for the chart, optional, default is 'default'. 'rough' refers to hand-drawn style.");
24
+ exports.WidthSchema = zod_1.z
25
+ .number()
26
+ .optional()
27
+ .default(600)
28
+ .describe("Set the width of chart, default is 600.");
29
+ exports.HeightSchema = zod_1.z
30
+ .number()
31
+ .optional()
32
+ .default(400)
33
+ .describe("Set the height of chart, default is 400.");
34
+ exports.TitleSchema = zod_1.z
35
+ .string()
36
+ .optional()
37
+ .default("")
38
+ .describe("Set the title of chart.");
39
+ exports.AxisXTitleSchema = zod_1.z
40
+ .string()
41
+ .optional()
42
+ .default("")
43
+ .describe("Set the x-axis title of chart.");
44
+ exports.AxisYTitleSchema = zod_1.z
45
+ .string()
46
+ .optional()
47
+ .default("")
48
+ .describe("Set the y-axis title of chart.");
49
+ exports.NodeSchema = zod_1.z.object({
50
+ name: zod_1.z.string(),
51
+ });
52
+ exports.EdgeSchema = zod_1.z.object({
53
+ source: zod_1.z.string(),
54
+ target: zod_1.z.string(),
55
+ name: zod_1.z.string().optional().default(""),
56
+ });
57
+ // --- The following are only available for Map charts ---
58
+ exports.MapTitleSchema = zod_1.z
59
+ .string()
60
+ .describe("The map title should not exceed 16 characters. The content should be consistent with the information the map wants to convey and should be accurate, rich, creative, and attractive.");
61
+ exports.MapWidthSchema = zod_1.z
62
+ .number()
63
+ .optional()
64
+ .default(1600)
65
+ .describe("Set the width of map, default is 1600.");
66
+ exports.MapHeightSchema = zod_1.z
67
+ .number()
68
+ .optional()
69
+ .default(1000)
70
+ .describe("Set the height of map, default is 1000.");
71
+ exports.POIsSchema = zod_1.z
72
+ .array(zod_1.z.string())
73
+ .nonempty("At least one POI name is required.")
74
+ .describe('A list of keywords for the names of points of interest (POIs) in Chinese. These POIs usually contain a group of places with similar locations, so the names should be more descriptive, must adding attributives to indicate that they are different places in the same area, such as "北京市" is better than "北京", "杭州西湖" is better than "西湖"; in addition, if you can determine that a location may appear in multiple areas, you can be more specific, such as "杭州西湖的苏堤春晓" is better than "苏堤春晓". The tool will use these keywords to search for specific POIs and query their detailed data, such as latitude and longitude, location photos, etc. For example, ["西安钟楼", "西安大唐不夜城", "西安大雁塔"].');
@@ -0,0 +1,47 @@
1
+ import { z } from "zod";
2
+ export declare const boxplot: {
3
+ schema: {
4
+ data: z.ZodArray<z.ZodObject<{
5
+ category: z.ZodString;
6
+ value: z.ZodNumber;
7
+ group: z.ZodOptional<z.ZodString>;
8
+ }, "strip", z.ZodTypeAny, {
9
+ value: number;
10
+ category: string;
11
+ group?: string | undefined;
12
+ }, {
13
+ value: number;
14
+ category: string;
15
+ group?: string | undefined;
16
+ }>, "atleastone">;
17
+ style: z.ZodOptional<z.ZodObject<{
18
+ backgroundColor: z.ZodOptional<z.ZodString>;
19
+ palette: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
20
+ texture: z.ZodDefault<z.ZodOptional<z.ZodEnum<["default", "rough"]>>>;
21
+ }, "strip", z.ZodTypeAny, {
22
+ texture: "default" | "rough";
23
+ backgroundColor?: string | undefined;
24
+ palette?: string[] | undefined;
25
+ }, {
26
+ backgroundColor?: string | undefined;
27
+ palette?: string[] | undefined;
28
+ texture?: "default" | "rough" | undefined;
29
+ }>>;
30
+ theme: z.ZodDefault<z.ZodOptional<z.ZodEnum<["default", "academy", "dark"]>>>;
31
+ width: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
32
+ height: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
33
+ title: z.ZodDefault<z.ZodOptional<z.ZodString>>;
34
+ axisXTitle: z.ZodDefault<z.ZodOptional<z.ZodString>>;
35
+ axisYTitle: z.ZodDefault<z.ZodOptional<z.ZodString>>;
36
+ };
37
+ tool: {
38
+ name: string;
39
+ description: string;
40
+ inputSchema: import("zod-to-json-schema").JsonSchema7Type & {
41
+ $schema?: string | undefined;
42
+ definitions?: {
43
+ [key: string]: import("zod-to-json-schema").JsonSchema7Type;
44
+ } | undefined;
45
+ };
46
+ };
47
+ };