@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
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.boxplot = void 0;
4
+ const zod_1 = require("zod");
5
+ const utils_1 = require("../utils/index.js");
6
+ const base_1 = require("./base.js");
7
+ const data = zod_1.z.object({
8
+ category: zod_1.z
9
+ .string()
10
+ .describe("Category of the data point, such as '分类一'."),
11
+ value: zod_1.z.number().describe("Value of the data point, such as 10."),
12
+ group: zod_1.z
13
+ .string()
14
+ .optional()
15
+ .describe("Optional group for the data point, used for grouping in the boxplot."),
16
+ });
17
+ const schema = {
18
+ data: zod_1.z
19
+ .array(data)
20
+ .describe("Data for boxplot chart, such as, [{ category: '分类一', value: 10 }] or [{ category: '分类二', value: 20, group: '组别一' }].")
21
+ .nonempty({ message: "Boxplot chart data cannot be empty." }),
22
+ style: zod_1.z
23
+ .object({
24
+ backgroundColor: base_1.BackgroundColorSchema,
25
+ palette: base_1.PaletteSchema,
26
+ texture: base_1.TextureSchema,
27
+ })
28
+ .optional()
29
+ .describe("Style configuration for the chart with a JSON object, optional."),
30
+ theme: base_1.ThemeSchema,
31
+ width: base_1.WidthSchema,
32
+ height: base_1.HeightSchema,
33
+ title: base_1.TitleSchema,
34
+ axisXTitle: base_1.AxisXTitleSchema,
35
+ axisYTitle: base_1.AxisYTitleSchema,
36
+ };
37
+ const tool = {
38
+ name: "generate_boxplot_chart",
39
+ description: "Generate a boxplot chart to show data for statistical summaries among different categories, such as, comparing the distribution of data points across categories.",
40
+ inputSchema: (0, utils_1.zodToJsonSchema)(schema),
41
+ };
42
+ exports.boxplot = {
43
+ schema,
44
+ tool,
45
+ };
@@ -0,0 +1,49 @@
1
+ import { z } from "zod";
2
+ export declare const column: {
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.column = void 0;
4
+ const zod_1 = require("zod");
5
+ const utils_1 = require("../utils/index.js");
6
+ const base_1 = require("./base.js");
7
+ // Column 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
+ // Column chart input schema
14
+ const schema = {
15
+ data: zod_1.z
16
+ .array(data)
17
+ .describe("Data for column chart, such as, [{ category: '分类一', value: 10 }, { category: '分类二', value: 20 }], when grouping or stacking is needed for column, the data should contain a `group` field, such as, when [{ category: '北京', value: 825, group: '油车' }, { category: '北京', value: 1000, group: '电车' }].")
18
+ .nonempty({ message: "Column chart data cannot be empty." }),
19
+ group: zod_1.z
20
+ .boolean()
21
+ .optional()
22
+ .default(true)
23
+ .describe("Whether grouping is enabled. When enabled, column 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(false)
28
+ .describe("Whether stacking is enabled. When enabled, column 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
+ // Column chart tool descriptor
45
+ const tool = {
46
+ name: "generate_column_chart",
47
+ description: "Generate a column chart, which are best for comparing categorical data, such as, when values are close, column charts are preferable because our eyes are better at judging height than other visual elements like area or angles.",
48
+ inputSchema: (0, utils_1.zodToJsonSchema)(schema),
49
+ };
50
+ exports.column = {
51
+ schema,
52
+ tool,
53
+ };
@@ -0,0 +1,93 @@
1
+ import { z } from "zod";
2
+ export declare const districtMap: {
3
+ schema: {
4
+ title: z.ZodString;
5
+ data: z.ZodObject<{
6
+ name: z.ZodString;
7
+ style: z.ZodOptional<z.ZodObject<{
8
+ fillColor: z.ZodOptional<z.ZodString>;
9
+ }, "strip", z.ZodTypeAny, {
10
+ fillColor?: string | undefined;
11
+ }, {
12
+ fillColor?: string | undefined;
13
+ }>>;
14
+ colors: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>;
15
+ dataType: z.ZodOptional<z.ZodEnum<["number", "enum"]>>;
16
+ dataLabel: z.ZodOptional<z.ZodString>;
17
+ dataValue: z.ZodOptional<z.ZodString>;
18
+ dataValueUnit: z.ZodOptional<z.ZodString>;
19
+ showAllSubdistricts: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
20
+ subdistricts: z.ZodOptional<z.ZodArray<z.ZodObject<{
21
+ name: z.ZodString;
22
+ dataValue: z.ZodOptional<z.ZodString>;
23
+ style: z.ZodOptional<z.ZodObject<{
24
+ fillColor: z.ZodOptional<z.ZodString>;
25
+ }, "strip", z.ZodTypeAny, {
26
+ fillColor?: string | undefined;
27
+ }, {
28
+ fillColor?: string | undefined;
29
+ }>>;
30
+ }, "strip", z.ZodTypeAny, {
31
+ name: string;
32
+ style?: {
33
+ fillColor?: string | undefined;
34
+ } | undefined;
35
+ dataValue?: string | undefined;
36
+ }, {
37
+ name: string;
38
+ style?: {
39
+ fillColor?: string | undefined;
40
+ } | undefined;
41
+ dataValue?: string | undefined;
42
+ }>, "many">>;
43
+ }, "strip", z.ZodTypeAny, {
44
+ name: string;
45
+ showAllSubdistricts: boolean;
46
+ style?: {
47
+ fillColor?: string | undefined;
48
+ } | undefined;
49
+ colors?: string[] | undefined;
50
+ dataType?: "number" | "enum" | undefined;
51
+ dataLabel?: string | undefined;
52
+ dataValue?: string | undefined;
53
+ dataValueUnit?: string | undefined;
54
+ subdistricts?: {
55
+ name: string;
56
+ style?: {
57
+ fillColor?: string | undefined;
58
+ } | undefined;
59
+ dataValue?: string | undefined;
60
+ }[] | undefined;
61
+ }, {
62
+ name: string;
63
+ style?: {
64
+ fillColor?: string | undefined;
65
+ } | undefined;
66
+ colors?: string[] | undefined;
67
+ dataType?: "number" | "enum" | undefined;
68
+ dataLabel?: string | undefined;
69
+ dataValue?: string | undefined;
70
+ dataValueUnit?: string | undefined;
71
+ showAllSubdistricts?: boolean | undefined;
72
+ subdistricts?: {
73
+ name: string;
74
+ style?: {
75
+ fillColor?: string | undefined;
76
+ } | undefined;
77
+ dataValue?: string | undefined;
78
+ }[] | undefined;
79
+ }>;
80
+ width: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
81
+ height: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
82
+ };
83
+ tool: {
84
+ name: string;
85
+ description: string;
86
+ inputSchema: import("zod-to-json-schema").JsonSchema7Type & {
87
+ $schema?: string | undefined;
88
+ definitions?: {
89
+ [key: string]: import("zod-to-json-schema").JsonSchema7Type;
90
+ } | undefined;
91
+ };
92
+ };
93
+ };
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.districtMap = void 0;
4
+ const zod_1 = require("zod");
5
+ const utils_1 = require("../utils/index.js");
6
+ const base_1 = require("./base.js");
7
+ const DistrictNameSchema = zod_1.z
8
+ .string()
9
+ .describe('Keywords for the Chinese name of an administrative region (must be within China), and must be one of China, province, city, district, or county. The name should be more specific and add attributive descriptions, for example, "西安市" is better than "西安", "杭州西湖区" is better than "西湖区". It cannot be a specific place name or a vague name, such as "其它".');
10
+ const StyleSchema = zod_1.z
11
+ .object({
12
+ fillColor: zod_1.z
13
+ .string()
14
+ .optional()
15
+ .describe("Fill color, rgb or rgba format."),
16
+ })
17
+ .optional()
18
+ .describe("Style settings.");
19
+ const SubDistrictSchema = zod_1.z.object({
20
+ name: DistrictNameSchema,
21
+ dataValue: zod_1.z
22
+ .string()
23
+ .optional()
24
+ .describe("Data value, numeric string or enumeration string."),
25
+ style: StyleSchema,
26
+ });
27
+ const schema = {
28
+ title: base_1.MapTitleSchema,
29
+ data: zod_1.z
30
+ .object({
31
+ name: DistrictNameSchema,
32
+ style: StyleSchema,
33
+ colors: zod_1.z
34
+ .array(zod_1.z.string())
35
+ .default([
36
+ "#1783FF",
37
+ "#00C9C9",
38
+ "#F0884D",
39
+ "#D580FF",
40
+ "#7863FF",
41
+ "#60C42D",
42
+ "#BD8F24",
43
+ "#FF80CA",
44
+ "#2491B3",
45
+ "#17C76F",
46
+ ])
47
+ .optional()
48
+ .describe("Data color list, in rgb or rgba format."),
49
+ dataType: zod_1.z
50
+ .enum(["number", "enum"])
51
+ .optional()
52
+ .describe("The type of the data value, numeric or enumeration type"),
53
+ dataLabel: zod_1.z.string().optional().describe('Data label, such as "GDP"'),
54
+ dataValue: zod_1.z
55
+ .string()
56
+ .optional()
57
+ .describe("Data value, numeric string or enumeration string."),
58
+ dataValueUnit: zod_1.z
59
+ .string()
60
+ .optional()
61
+ .describe('Data unit, such as "万亿"'),
62
+ showAllSubdistricts: zod_1.z
63
+ .boolean()
64
+ .optional()
65
+ .default(false)
66
+ .describe("Whether to display all subdistricts."),
67
+ subdistricts: zod_1.z
68
+ .array(SubDistrictSchema)
69
+ .optional()
70
+ .describe("Sub-administrative regions are used to display the regional composition or regional distribution of related data."),
71
+ })
72
+ .describe('Administrative division data, lower-level administrative divisions are optional. There are usually two scenarios: one is to simply display the regional composition, only `fillColor` needs to be configured, and all administrative divisions are consistent, representing that all blocks are connected as one; the other is the regional data distribution scenario, first determine the `dataType`, `dataValueUnit` and `dataLabel` configurations, `dataValue` should be a meaningful value and consistent with the meaning of dataType, and then determine the style configuration. The `fillColor` configuration represents the default fill color for areas without data. Lower-level administrative divisions do not need `fillColor` configuration, and their fill colors are determined by the `colors` configuration (If `dataType` is "number", only one base color (warm color) is needed in the list to calculate the continuous data mapping color band; if `dataType` is "enum", the number of color values in the list is equal to the number of enumeration values (contrast colors)). If `subdistricts` has a value, `showAllSubdistricts` must be set to true. For example, {"title": "陕西省地级市分布图", "data": {"name": "陕西省", "showAllSubdistricts": true, "dataLabel": "城市", "dataType": "enum", "colors": ["#4ECDC4", "#A5D8FF"], "subdistricts": [{"name": "西安市", "dataValue": "省会"}, {"name": "宝鸡市", "dataValue": "地级市"}, {"name": "咸阳市", "dataValue": "地级市"}, {"name": "铜川市", "dataValue": "地级市"}, {"name": "渭南市", "dataValue": "地级市"}, {"name": "延安市", "dataValue": "地级市"}, {"name": "榆林市", "dataValue": "地级市"}, {"name": "汉中市", "dataValue": "地级市"}, {"name": "安康市", "dataValue": "地级市"}, {"name": "商洛市", "dataValue": "地级市"}]}, "width": 1000, "height": 1000}.'),
73
+ width: base_1.MapWidthSchema,
74
+ height: base_1.MapHeightSchema,
75
+ };
76
+ // https://modelcontextprotocol.io/specification/2025-03-26/server/tools#listing-tools
77
+ const tool = {
78
+ name: "generate_district_map",
79
+ description: "Generates regional distribution maps, which are usually used to show the administrative divisions and coverage of a dataset. It is not suitable for showing the distribution of specific locations, such as urban administrative divisions, GDP distribution maps of provinces and cities across the country, etc. This tool is limited to generating data maps within China.",
80
+ inputSchema: (0, utils_1.zodToJsonSchema)(schema),
81
+ };
82
+ exports.districtMap = {
83
+ schema,
84
+ tool,
85
+ };
@@ -0,0 +1,47 @@
1
+ import { z } from "zod";
2
+ export declare const dualAxes: {
3
+ schema: {
4
+ categories: z.ZodArray<z.ZodString, "atleastone">;
5
+ series: z.ZodArray<z.ZodObject<{
6
+ type: z.ZodEnum<["column", "line"]>;
7
+ data: z.ZodArray<z.ZodNumber, "many">;
8
+ axisYTitle: z.ZodOptional<z.ZodDefault<z.ZodString>>;
9
+ }, "strip", z.ZodTypeAny, {
10
+ type: "column" | "line";
11
+ data: number[];
12
+ axisYTitle?: string | undefined;
13
+ }, {
14
+ type: "column" | "line";
15
+ data: number[];
16
+ axisYTitle?: string | undefined;
17
+ }>, "atleastone">;
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
+ }, "strip", z.ZodTypeAny, {
23
+ texture: "default" | "rough";
24
+ backgroundColor?: string | undefined;
25
+ palette?: string[] | undefined;
26
+ }, {
27
+ backgroundColor?: string | undefined;
28
+ palette?: string[] | undefined;
29
+ texture?: "default" | "rough" | undefined;
30
+ }>>;
31
+ theme: z.ZodDefault<z.ZodOptional<z.ZodEnum<["default", "academy", "dark"]>>>;
32
+ width: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
33
+ height: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
34
+ title: z.ZodDefault<z.ZodOptional<z.ZodString>>;
35
+ axisXTitle: 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
+ };
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dualAxes = void 0;
4
+ const zod_1 = require("zod");
5
+ const utils_1 = require("../utils/index.js");
6
+ const base_1 = require("./base.js");
7
+ // Dual axes series schema
8
+ const DualAxesSeriesSchema = zod_1.z.object({
9
+ type: zod_1.z
10
+ .enum(["column", "line"])
11
+ .describe("The optional value can be 'column' or 'line'."),
12
+ data: zod_1.z
13
+ .array(zod_1.z.number())
14
+ .describe("When type is column, the data represents quantities, such as [91.9, 99.1, 101.6, 114.4, 121]. When type is line, the data represents ratios and its values are recommended to be less than 1, such as [0.055, 0.06, 0.062, 0.07, 0.075]."),
15
+ axisYTitle: zod_1.z
16
+ .string()
17
+ .default("")
18
+ .describe("Set the y-axis title of the chart series, such as, axisYTitle: '销售额'.")
19
+ .optional(),
20
+ });
21
+ // Dual axes chart input schema
22
+ const schema = {
23
+ categories: zod_1.z
24
+ .array(zod_1.z.string())
25
+ .describe("Categories for dual axes chart, such as, ['2015', '2016', '2017'].")
26
+ .nonempty({ message: "Dual axes chart categories cannot be empty." }),
27
+ series: zod_1.z
28
+ .array(DualAxesSeriesSchema)
29
+ .describe("Series for dual axes chart, such as, [{ type: 'column', data: [91.9, 99.1, 101.6, 114.4, 121], axisYTitle: '销售额' }, { type: 'line', data: [0.055, 0.06, 0.062, 0.07, 0.075], 'axisYTitle': '利润率' }].")
30
+ .nonempty({ message: "Dual axes chart series cannot be empty." }),
31
+ style: zod_1.z
32
+ .object({
33
+ backgroundColor: base_1.BackgroundColorSchema,
34
+ palette: base_1.PaletteSchema,
35
+ texture: base_1.TextureSchema,
36
+ })
37
+ .optional()
38
+ .describe("Style configuration for the chart with a JSON object, optional."),
39
+ theme: base_1.ThemeSchema,
40
+ width: base_1.WidthSchema,
41
+ height: base_1.HeightSchema,
42
+ title: base_1.TitleSchema,
43
+ axisXTitle: base_1.AxisXTitleSchema,
44
+ };
45
+ // Dual axes chart tool descriptor
46
+ const tool = {
47
+ name: "generate_dual_axes_chart",
48
+ description: "Generate a dual axes chart which is a combination chart that integrates two different chart types, typically combining a bar chart with a line chart to display both the trend and comparison of data, such as, the trend of sales and profit over time.",
49
+ inputSchema: (0, utils_1.zodToJsonSchema)(schema),
50
+ };
51
+ exports.dualAxes = {
52
+ schema,
53
+ tool,
54
+ };
@@ -0,0 +1,28 @@
1
+ import { z } from "zod";
2
+ import { type TreeDataType } from "../utils/validator";
3
+ export declare const FishboneNodeSchema: z.ZodType<TreeDataType>;
4
+ export declare const fishboneDiagram: {
5
+ schema: {
6
+ data: z.ZodEffects<z.ZodType<TreeDataType, z.ZodTypeDef, TreeDataType>, TreeDataType, TreeDataType>;
7
+ style: z.ZodOptional<z.ZodObject<{
8
+ texture: z.ZodDefault<z.ZodOptional<z.ZodEnum<["default", "rough"]>>>;
9
+ }, "strip", z.ZodTypeAny, {
10
+ texture: "default" | "rough";
11
+ }, {
12
+ texture?: "default" | "rough" | undefined;
13
+ }>>;
14
+ theme: z.ZodDefault<z.ZodOptional<z.ZodEnum<["default", "academy", "dark"]>>>;
15
+ width: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
16
+ height: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
17
+ };
18
+ tool: {
19
+ name: string;
20
+ description: string;
21
+ inputSchema: import("zod-to-json-schema").JsonSchema7Type & {
22
+ $schema?: string | undefined;
23
+ definitions?: {
24
+ [key: string]: import("zod-to-json-schema").JsonSchema7Type;
25
+ } | undefined;
26
+ };
27
+ };
28
+ };
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fishboneDiagram = exports.FishboneNodeSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const utils_1 = require("../utils/index.js");
6
+ const validator_1 = require("../utils/validator.js");
7
+ const base_1 = require("./base.js");
8
+ // Fishbone node schema
9
+ // The recursive schema is not supported by gemini, and other clients, so we use a non-recursive schema which can represent a tree structure with a fixed depth.
10
+ // Ref: https://github.com/antvis/mcp-server-chart/issues/155
11
+ // Ref: https://github.com/antvis/mcp-server-chart/issues/132
12
+ exports.FishboneNodeSchema = zod_1.z.object({
13
+ name: zod_1.z.string(),
14
+ children: zod_1.z
15
+ .array(zod_1.z.object({
16
+ name: zod_1.z.string(),
17
+ children: zod_1.z
18
+ .array(zod_1.z.object({
19
+ name: zod_1.z.string(),
20
+ children: zod_1.z
21
+ .array(zod_1.z.object({
22
+ name: zod_1.z.string(),
23
+ }))
24
+ .optional(),
25
+ }))
26
+ .optional(),
27
+ }))
28
+ .optional(),
29
+ });
30
+ // Fishbone diagram input schema
31
+ const schema = {
32
+ data: exports.FishboneNodeSchema.describe("Data for fishbone diagram chart which is a hierarchical structure, such as, { name: 'main topic', children: [{ name: 'topic 1', children: [{ name: 'subtopic 1-1' }] }] }, and the maximum depth is 3.").refine(validator_1.validatedTreeDataSchema, {
33
+ message: "Invalid parameters: node name is not unique.",
34
+ path: ["data"],
35
+ }),
36
+ style: zod_1.z
37
+ .object({
38
+ texture: base_1.TextureSchema,
39
+ })
40
+ .optional()
41
+ .describe("Style configuration for the chart with a JSON object, optional."),
42
+ theme: base_1.ThemeSchema,
43
+ width: base_1.WidthSchema,
44
+ height: base_1.HeightSchema,
45
+ };
46
+ // Fishbone diagram tool descriptor
47
+ const tool = {
48
+ name: "generate_fishbone_diagram",
49
+ description: "Generate a fishbone diagram chart to uses a fish skeleton, like structure to display the causes or effects of a core problem, with the problem as the fish head and the causes/effects as the fish bones. It suits problems that can be split into multiple related factors.",
50
+ inputSchema: (0, utils_1.zodToJsonSchema)(schema),
51
+ };
52
+ exports.fishboneDiagram = {
53
+ schema,
54
+ tool,
55
+ };
@@ -0,0 +1,91 @@
1
+ import { z } from "zod";
2
+ export declare const flowDiagram: {
3
+ schema: {
4
+ data: z.ZodEffects<z.ZodObject<{
5
+ nodes: z.ZodArray<z.ZodObject<{
6
+ name: z.ZodString;
7
+ }, "strip", z.ZodTypeAny, {
8
+ name: string;
9
+ }, {
10
+ name: string;
11
+ }>, "atleastone">;
12
+ edges: z.ZodArray<z.ZodObject<{
13
+ source: z.ZodString;
14
+ target: z.ZodString;
15
+ name: z.ZodDefault<z.ZodOptional<z.ZodString>>;
16
+ }, "strip", z.ZodTypeAny, {
17
+ name: string;
18
+ target: string;
19
+ source: string;
20
+ }, {
21
+ target: string;
22
+ source: string;
23
+ name?: string | undefined;
24
+ }>, "many">;
25
+ }, "strip", z.ZodTypeAny, {
26
+ nodes: [{
27
+ name: string;
28
+ }, ...{
29
+ name: string;
30
+ }[]];
31
+ edges: {
32
+ name: string;
33
+ target: string;
34
+ source: string;
35
+ }[];
36
+ }, {
37
+ nodes: [{
38
+ name: string;
39
+ }, ...{
40
+ name: string;
41
+ }[]];
42
+ edges: {
43
+ target: string;
44
+ source: string;
45
+ name?: string | undefined;
46
+ }[];
47
+ }>, {
48
+ nodes: [{
49
+ name: string;
50
+ }, ...{
51
+ name: string;
52
+ }[]];
53
+ edges: {
54
+ name: string;
55
+ target: string;
56
+ source: string;
57
+ }[];
58
+ }, {
59
+ nodes: [{
60
+ name: string;
61
+ }, ...{
62
+ name: string;
63
+ }[]];
64
+ edges: {
65
+ target: string;
66
+ source: string;
67
+ name?: string | undefined;
68
+ }[];
69
+ }>;
70
+ style: z.ZodOptional<z.ZodObject<{
71
+ texture: z.ZodDefault<z.ZodOptional<z.ZodEnum<["default", "rough"]>>>;
72
+ }, "strip", z.ZodTypeAny, {
73
+ texture: "default" | "rough";
74
+ }, {
75
+ texture?: "default" | "rough" | undefined;
76
+ }>>;
77
+ theme: z.ZodDefault<z.ZodOptional<z.ZodEnum<["default", "academy", "dark"]>>>;
78
+ width: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
79
+ height: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
80
+ };
81
+ tool: {
82
+ name: string;
83
+ description: string;
84
+ inputSchema: import("zod-to-json-schema").JsonSchema7Type & {
85
+ $schema?: string | undefined;
86
+ definitions?: {
87
+ [key: string]: import("zod-to-json-schema").JsonSchema7Type;
88
+ } | undefined;
89
+ };
90
+ };
91
+ };
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.flowDiagram = void 0;
4
+ const zod_1 = require("zod");
5
+ const utils_1 = require("../utils/index.js");
6
+ const validator_1 = require("../utils/validator.js");
7
+ const base_1 = require("./base.js");
8
+ // Flow diagram input schema
9
+ const schema = {
10
+ data: zod_1.z
11
+ .object({
12
+ nodes: zod_1.z
13
+ .array(base_1.NodeSchema)
14
+ .nonempty({ message: "At least one node is required." }),
15
+ edges: zod_1.z.array(base_1.EdgeSchema),
16
+ })
17
+ .describe("Data for flow diagram chart, such as, { nodes: [{ name: 'node1' }, { name: 'node2' }], edges: [{ source: 'node1', target: 'node2', name: 'edge1' }] }.")
18
+ .refine(validator_1.validatedNodeEdgeDataSchema, {
19
+ message: "Invalid parameters",
20
+ path: ["data", "edges"],
21
+ }),
22
+ style: zod_1.z
23
+ .object({
24
+ texture: base_1.TextureSchema,
25
+ })
26
+ .optional()
27
+ .describe("Style configuration for the chart with a JSON object, optional."),
28
+ theme: base_1.ThemeSchema,
29
+ width: base_1.WidthSchema,
30
+ height: base_1.HeightSchema,
31
+ };
32
+ // Flow diagram tool descriptor
33
+ const tool = {
34
+ name: "generate_flow_diagram",
35
+ description: "Generate a flow diagram chart to show the steps and decision points of a process or system, such as, scenarios requiring linear process presentation.",
36
+ inputSchema: (0, utils_1.zodToJsonSchema)(schema),
37
+ };
38
+ exports.flowDiagram = {
39
+ schema,
40
+ tool,
41
+ };