@dotzero.ai/export-mcp 1.2.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.
- package/README.md +474 -0
- package/dist/chart-engine.d.ts +29 -0
- package/dist/chart-engine.js +1 -0
- package/dist/colors.d.ts +21 -0
- package/dist/colors.js +1 -0
- package/dist/export-engine.d.ts +17 -0
- package/dist/export-engine.js +1 -0
- package/dist/file-output.d.ts +10 -0
- package/dist/file-output.js +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +2 -0
- package/dist/schemas.d.ts +126 -0
- package/dist/schemas.js +1 -0
- package/dist/tool-registry.d.ts +10 -0
- package/dist/tool-registry.js +1 -0
- package/dist/tools/charts/bar.d.ts +214 -0
- package/dist/tools/charts/bar.js +1 -0
- package/dist/tools/charts/control-chart.d.ts +109 -0
- package/dist/tools/charts/control-chart.js +1 -0
- package/dist/tools/charts/gauge.d.ts +120 -0
- package/dist/tools/charts/gauge.js +1 -0
- package/dist/tools/charts/index.d.ts +9 -0
- package/dist/tools/charts/index.js +1 -0
- package/dist/tools/charts/line.d.ts +226 -0
- package/dist/tools/charts/line.js +1 -0
- package/dist/tools/charts/multi.d.ts +466 -0
- package/dist/tools/charts/multi.js +1 -0
- package/dist/tools/charts/oee-breakdown.d.ts +156 -0
- package/dist/tools/charts/oee-breakdown.js +1 -0
- package/dist/tools/charts/pie.d.ts +90 -0
- package/dist/tools/charts/pie.js +1 -0
- package/dist/tools/charts/scatter.d.ts +250 -0
- package/dist/tools/charts/scatter.js +1 -0
- package/dist/tools/charts/timeline.d.ts +128 -0
- package/dist/tools/charts/timeline.js +1 -0
- package/dist/tools/exports/csv.d.ts +51 -0
- package/dist/tools/exports/csv.js +1 -0
- package/dist/tools/exports/index.d.ts +2 -0
- package/dist/tools/exports/index.js +1 -0
- package/dist/tools/exports/xlsx.d.ts +85 -0
- package/dist/tools/exports/xlsx.js +1 -0
- package/dist/tools/smart/chart-from-json.d.ts +84 -0
- package/dist/tools/smart/chart-from-json.js +1 -0
- package/dist/tools/smart/index.d.ts +2 -0
- package/dist/tools/smart/index.js +1 -0
- package/dist/tools/smart/table-from-json.d.ts +63 -0
- package/dist/tools/smart/table-from-json.js +1 -0
- package/dist/types.d.ts +75 -0
- package/dist/types.js +1 -0
- package/package.json +64 -0
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const ChartLineSchema: z.ZodObject<{
|
|
3
|
+
title: z.ZodString;
|
|
4
|
+
labels: z.ZodArray<z.ZodString, "many">;
|
|
5
|
+
datasets: z.ZodArray<z.ZodObject<{
|
|
6
|
+
label: z.ZodString;
|
|
7
|
+
data: z.ZodArray<z.ZodNumber, "many">;
|
|
8
|
+
color: z.ZodOptional<z.ZodString>;
|
|
9
|
+
} & {
|
|
10
|
+
fill: z.ZodOptional<z.ZodBoolean>;
|
|
11
|
+
}, "strict", z.ZodTypeAny, {
|
|
12
|
+
label: string;
|
|
13
|
+
data: number[];
|
|
14
|
+
color?: string | undefined;
|
|
15
|
+
fill?: boolean | undefined;
|
|
16
|
+
}, {
|
|
17
|
+
label: string;
|
|
18
|
+
data: number[];
|
|
19
|
+
color?: string | undefined;
|
|
20
|
+
fill?: boolean | undefined;
|
|
21
|
+
}>, "many">;
|
|
22
|
+
options: z.ZodOptional<z.ZodObject<{
|
|
23
|
+
stacked: z.ZodOptional<z.ZodBoolean>;
|
|
24
|
+
horizontal: z.ZodOptional<z.ZodBoolean>;
|
|
25
|
+
show_legend: z.ZodOptional<z.ZodBoolean>;
|
|
26
|
+
show_grid: z.ZodOptional<z.ZodBoolean>;
|
|
27
|
+
x_label: z.ZodOptional<z.ZodString>;
|
|
28
|
+
y_label: z.ZodOptional<z.ZodString>;
|
|
29
|
+
min_y: z.ZodOptional<z.ZodNumber>;
|
|
30
|
+
max_y: z.ZodOptional<z.ZodNumber>;
|
|
31
|
+
}, "strict", z.ZodTypeAny, {
|
|
32
|
+
stacked?: boolean | undefined;
|
|
33
|
+
horizontal?: boolean | undefined;
|
|
34
|
+
show_legend?: boolean | undefined;
|
|
35
|
+
show_grid?: boolean | undefined;
|
|
36
|
+
x_label?: string | undefined;
|
|
37
|
+
y_label?: string | undefined;
|
|
38
|
+
min_y?: number | undefined;
|
|
39
|
+
max_y?: number | undefined;
|
|
40
|
+
}, {
|
|
41
|
+
stacked?: boolean | undefined;
|
|
42
|
+
horizontal?: boolean | undefined;
|
|
43
|
+
show_legend?: boolean | undefined;
|
|
44
|
+
show_grid?: boolean | undefined;
|
|
45
|
+
x_label?: string | undefined;
|
|
46
|
+
y_label?: string | undefined;
|
|
47
|
+
min_y?: number | undefined;
|
|
48
|
+
max_y?: number | undefined;
|
|
49
|
+
}>>;
|
|
50
|
+
} & {
|
|
51
|
+
output_path: z.ZodOptional<z.ZodString>;
|
|
52
|
+
width: z.ZodDefault<z.ZodNumber>;
|
|
53
|
+
height: z.ZodDefault<z.ZodNumber>;
|
|
54
|
+
format: z.ZodDefault<z.ZodEnum<["png", "jpg"]>>;
|
|
55
|
+
}, "strict", z.ZodTypeAny, {
|
|
56
|
+
width: number;
|
|
57
|
+
height: number;
|
|
58
|
+
format: "png" | "jpg";
|
|
59
|
+
title: string;
|
|
60
|
+
labels: string[];
|
|
61
|
+
datasets: {
|
|
62
|
+
label: string;
|
|
63
|
+
data: number[];
|
|
64
|
+
color?: string | undefined;
|
|
65
|
+
fill?: boolean | undefined;
|
|
66
|
+
}[];
|
|
67
|
+
options?: {
|
|
68
|
+
stacked?: boolean | undefined;
|
|
69
|
+
horizontal?: boolean | undefined;
|
|
70
|
+
show_legend?: boolean | undefined;
|
|
71
|
+
show_grid?: boolean | undefined;
|
|
72
|
+
x_label?: string | undefined;
|
|
73
|
+
y_label?: string | undefined;
|
|
74
|
+
min_y?: number | undefined;
|
|
75
|
+
max_y?: number | undefined;
|
|
76
|
+
} | undefined;
|
|
77
|
+
output_path?: string | undefined;
|
|
78
|
+
}, {
|
|
79
|
+
title: string;
|
|
80
|
+
labels: string[];
|
|
81
|
+
datasets: {
|
|
82
|
+
label: string;
|
|
83
|
+
data: number[];
|
|
84
|
+
color?: string | undefined;
|
|
85
|
+
fill?: boolean | undefined;
|
|
86
|
+
}[];
|
|
87
|
+
width?: number | undefined;
|
|
88
|
+
height?: number | undefined;
|
|
89
|
+
options?: {
|
|
90
|
+
stacked?: boolean | undefined;
|
|
91
|
+
horizontal?: boolean | undefined;
|
|
92
|
+
show_legend?: boolean | undefined;
|
|
93
|
+
show_grid?: boolean | undefined;
|
|
94
|
+
x_label?: string | undefined;
|
|
95
|
+
y_label?: string | undefined;
|
|
96
|
+
min_y?: number | undefined;
|
|
97
|
+
max_y?: number | undefined;
|
|
98
|
+
} | undefined;
|
|
99
|
+
output_path?: string | undefined;
|
|
100
|
+
format?: "png" | "jpg" | undefined;
|
|
101
|
+
}>;
|
|
102
|
+
export type ChartLineInput = z.infer<typeof ChartLineSchema>;
|
|
103
|
+
export declare const chartLineTool: {
|
|
104
|
+
name: string;
|
|
105
|
+
title: string;
|
|
106
|
+
description: string;
|
|
107
|
+
inputSchema: z.ZodObject<{
|
|
108
|
+
title: z.ZodString;
|
|
109
|
+
labels: z.ZodArray<z.ZodString, "many">;
|
|
110
|
+
datasets: z.ZodArray<z.ZodObject<{
|
|
111
|
+
label: z.ZodString;
|
|
112
|
+
data: z.ZodArray<z.ZodNumber, "many">;
|
|
113
|
+
color: z.ZodOptional<z.ZodString>;
|
|
114
|
+
} & {
|
|
115
|
+
fill: z.ZodOptional<z.ZodBoolean>;
|
|
116
|
+
}, "strict", z.ZodTypeAny, {
|
|
117
|
+
label: string;
|
|
118
|
+
data: number[];
|
|
119
|
+
color?: string | undefined;
|
|
120
|
+
fill?: boolean | undefined;
|
|
121
|
+
}, {
|
|
122
|
+
label: string;
|
|
123
|
+
data: number[];
|
|
124
|
+
color?: string | undefined;
|
|
125
|
+
fill?: boolean | undefined;
|
|
126
|
+
}>, "many">;
|
|
127
|
+
options: z.ZodOptional<z.ZodObject<{
|
|
128
|
+
stacked: z.ZodOptional<z.ZodBoolean>;
|
|
129
|
+
horizontal: z.ZodOptional<z.ZodBoolean>;
|
|
130
|
+
show_legend: z.ZodOptional<z.ZodBoolean>;
|
|
131
|
+
show_grid: z.ZodOptional<z.ZodBoolean>;
|
|
132
|
+
x_label: z.ZodOptional<z.ZodString>;
|
|
133
|
+
y_label: z.ZodOptional<z.ZodString>;
|
|
134
|
+
min_y: z.ZodOptional<z.ZodNumber>;
|
|
135
|
+
max_y: z.ZodOptional<z.ZodNumber>;
|
|
136
|
+
}, "strict", z.ZodTypeAny, {
|
|
137
|
+
stacked?: boolean | undefined;
|
|
138
|
+
horizontal?: boolean | undefined;
|
|
139
|
+
show_legend?: boolean | undefined;
|
|
140
|
+
show_grid?: boolean | undefined;
|
|
141
|
+
x_label?: string | undefined;
|
|
142
|
+
y_label?: string | undefined;
|
|
143
|
+
min_y?: number | undefined;
|
|
144
|
+
max_y?: number | undefined;
|
|
145
|
+
}, {
|
|
146
|
+
stacked?: boolean | undefined;
|
|
147
|
+
horizontal?: boolean | undefined;
|
|
148
|
+
show_legend?: boolean | undefined;
|
|
149
|
+
show_grid?: boolean | undefined;
|
|
150
|
+
x_label?: string | undefined;
|
|
151
|
+
y_label?: string | undefined;
|
|
152
|
+
min_y?: number | undefined;
|
|
153
|
+
max_y?: number | undefined;
|
|
154
|
+
}>>;
|
|
155
|
+
} & {
|
|
156
|
+
output_path: z.ZodOptional<z.ZodString>;
|
|
157
|
+
width: z.ZodDefault<z.ZodNumber>;
|
|
158
|
+
height: z.ZodDefault<z.ZodNumber>;
|
|
159
|
+
format: z.ZodDefault<z.ZodEnum<["png", "jpg"]>>;
|
|
160
|
+
}, "strict", z.ZodTypeAny, {
|
|
161
|
+
width: number;
|
|
162
|
+
height: number;
|
|
163
|
+
format: "png" | "jpg";
|
|
164
|
+
title: string;
|
|
165
|
+
labels: string[];
|
|
166
|
+
datasets: {
|
|
167
|
+
label: string;
|
|
168
|
+
data: number[];
|
|
169
|
+
color?: string | undefined;
|
|
170
|
+
fill?: boolean | undefined;
|
|
171
|
+
}[];
|
|
172
|
+
options?: {
|
|
173
|
+
stacked?: boolean | undefined;
|
|
174
|
+
horizontal?: boolean | undefined;
|
|
175
|
+
show_legend?: boolean | undefined;
|
|
176
|
+
show_grid?: boolean | undefined;
|
|
177
|
+
x_label?: string | undefined;
|
|
178
|
+
y_label?: string | undefined;
|
|
179
|
+
min_y?: number | undefined;
|
|
180
|
+
max_y?: number | undefined;
|
|
181
|
+
} | undefined;
|
|
182
|
+
output_path?: string | undefined;
|
|
183
|
+
}, {
|
|
184
|
+
title: string;
|
|
185
|
+
labels: string[];
|
|
186
|
+
datasets: {
|
|
187
|
+
label: string;
|
|
188
|
+
data: number[];
|
|
189
|
+
color?: string | undefined;
|
|
190
|
+
fill?: boolean | undefined;
|
|
191
|
+
}[];
|
|
192
|
+
width?: number | undefined;
|
|
193
|
+
height?: number | undefined;
|
|
194
|
+
options?: {
|
|
195
|
+
stacked?: boolean | undefined;
|
|
196
|
+
horizontal?: boolean | undefined;
|
|
197
|
+
show_legend?: boolean | undefined;
|
|
198
|
+
show_grid?: boolean | undefined;
|
|
199
|
+
x_label?: string | undefined;
|
|
200
|
+
y_label?: string | undefined;
|
|
201
|
+
min_y?: number | undefined;
|
|
202
|
+
max_y?: number | undefined;
|
|
203
|
+
} | undefined;
|
|
204
|
+
output_path?: string | undefined;
|
|
205
|
+
format?: "png" | "jpg" | undefined;
|
|
206
|
+
}>;
|
|
207
|
+
annotations: {
|
|
208
|
+
readOnlyHint: boolean;
|
|
209
|
+
destructiveHint: boolean;
|
|
210
|
+
idempotentHint: boolean;
|
|
211
|
+
openWorldHint: boolean;
|
|
212
|
+
};
|
|
213
|
+
};
|
|
214
|
+
export declare function executeChartLine(params: ChartLineInput): Promise<{
|
|
215
|
+
content: ({
|
|
216
|
+
type: "text";
|
|
217
|
+
text: string;
|
|
218
|
+
data?: undefined;
|
|
219
|
+
mimeType?: undefined;
|
|
220
|
+
} | {
|
|
221
|
+
type: "image";
|
|
222
|
+
data: string;
|
|
223
|
+
mimeType: "image/png" | "image/jpeg";
|
|
224
|
+
text?: undefined;
|
|
225
|
+
})[];
|
|
226
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{z}from"zod";import{ChartDatasetSchema,ChartOptionsSchema,BaseChartParams}from"../../schemas.js";import{renderChart,chartResultToContent}from"../../chart-engine.js";import{getSeriesColor,withAlpha}from"../../colors.js";export const ChartLineSchema=z.object({title:z.string().describe("Chart title"),labels:z.array(z.string()).describe("X-axis labels"),datasets:z.array(ChartDatasetSchema.extend({fill:z.boolean().optional().describe("Fill area under line")})).describe("Data series"),options:ChartOptionsSchema}).merge(BaseChartParams).strict();export const chartLineTool={name:"chart_line",title:"Line Chart",description:"Generate a line chart with one or more series. Supports area fill and stacking.",inputSchema:ChartLineSchema,annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}};export async function executeChartLine(t){const e=t.options||{},a={type:"line",data:{labels:t.labels,datasets:t.datasets.map((t,e)=>{const a=t.color||getSeriesColor(e);return{label:t.label,data:t.data,borderColor:a,backgroundColor:withAlpha(a,.2),fill:t.fill||!1,tension:.3,pointRadius:3}})},options:{responsive:!1,plugins:{title:{display:!0,text:t.title,font:{size:16}},legend:{display:!1!==e.show_legend}},scales:{x:{stacked:e.stacked,title:{display:!!e.x_label,text:e.x_label},grid:{display:!1!==e.show_grid}},y:{stacked:e.stacked,title:{display:!!e.y_label,text:e.y_label},grid:{display:!1!==e.show_grid},min:e.min_y,max:e.max_y}}}},i=await renderChart(a,{width:t.width,height:t.height,format:t.format,outputPath:t.output_path,title:t.title});return chartResultToContent(i)}
|
|
@@ -0,0 +1,466 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const ChartMultiSchema: z.ZodObject<{
|
|
3
|
+
title: z.ZodDefault<z.ZodString>;
|
|
4
|
+
charts: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
5
|
+
type: z.ZodLiteral<"bar">;
|
|
6
|
+
title: z.ZodString;
|
|
7
|
+
labels: z.ZodArray<z.ZodString, "many">;
|
|
8
|
+
datasets: z.ZodArray<z.ZodObject<{
|
|
9
|
+
label: z.ZodString;
|
|
10
|
+
data: z.ZodArray<z.ZodNumber, "many">;
|
|
11
|
+
color: z.ZodOptional<z.ZodString>;
|
|
12
|
+
}, "strict", z.ZodTypeAny, {
|
|
13
|
+
label: string;
|
|
14
|
+
data: number[];
|
|
15
|
+
color?: string | undefined;
|
|
16
|
+
}, {
|
|
17
|
+
label: string;
|
|
18
|
+
data: number[];
|
|
19
|
+
color?: string | undefined;
|
|
20
|
+
}>, "many">;
|
|
21
|
+
}, "strict", z.ZodTypeAny, {
|
|
22
|
+
type: "bar";
|
|
23
|
+
title: string;
|
|
24
|
+
labels: string[];
|
|
25
|
+
datasets: {
|
|
26
|
+
label: string;
|
|
27
|
+
data: number[];
|
|
28
|
+
color?: string | undefined;
|
|
29
|
+
}[];
|
|
30
|
+
}, {
|
|
31
|
+
type: "bar";
|
|
32
|
+
title: string;
|
|
33
|
+
labels: string[];
|
|
34
|
+
datasets: {
|
|
35
|
+
label: string;
|
|
36
|
+
data: number[];
|
|
37
|
+
color?: string | undefined;
|
|
38
|
+
}[];
|
|
39
|
+
}>, z.ZodObject<{
|
|
40
|
+
type: z.ZodLiteral<"line">;
|
|
41
|
+
title: z.ZodString;
|
|
42
|
+
labels: z.ZodArray<z.ZodString, "many">;
|
|
43
|
+
datasets: z.ZodArray<z.ZodObject<{
|
|
44
|
+
label: z.ZodString;
|
|
45
|
+
data: z.ZodArray<z.ZodNumber, "many">;
|
|
46
|
+
color: z.ZodOptional<z.ZodString>;
|
|
47
|
+
}, "strict", z.ZodTypeAny, {
|
|
48
|
+
label: string;
|
|
49
|
+
data: number[];
|
|
50
|
+
color?: string | undefined;
|
|
51
|
+
}, {
|
|
52
|
+
label: string;
|
|
53
|
+
data: number[];
|
|
54
|
+
color?: string | undefined;
|
|
55
|
+
}>, "many">;
|
|
56
|
+
}, "strict", z.ZodTypeAny, {
|
|
57
|
+
type: "line";
|
|
58
|
+
title: string;
|
|
59
|
+
labels: string[];
|
|
60
|
+
datasets: {
|
|
61
|
+
label: string;
|
|
62
|
+
data: number[];
|
|
63
|
+
color?: string | undefined;
|
|
64
|
+
}[];
|
|
65
|
+
}, {
|
|
66
|
+
type: "line";
|
|
67
|
+
title: string;
|
|
68
|
+
labels: string[];
|
|
69
|
+
datasets: {
|
|
70
|
+
label: string;
|
|
71
|
+
data: number[];
|
|
72
|
+
color?: string | undefined;
|
|
73
|
+
}[];
|
|
74
|
+
}>, z.ZodObject<{
|
|
75
|
+
type: z.ZodLiteral<"pie">;
|
|
76
|
+
title: z.ZodString;
|
|
77
|
+
labels: z.ZodArray<z.ZodString, "many">;
|
|
78
|
+
values: z.ZodArray<z.ZodNumber, "many">;
|
|
79
|
+
}, "strict", z.ZodTypeAny, {
|
|
80
|
+
values: number[];
|
|
81
|
+
type: "pie";
|
|
82
|
+
title: string;
|
|
83
|
+
labels: string[];
|
|
84
|
+
}, {
|
|
85
|
+
values: number[];
|
|
86
|
+
type: "pie";
|
|
87
|
+
title: string;
|
|
88
|
+
labels: string[];
|
|
89
|
+
}>, z.ZodObject<{
|
|
90
|
+
type: z.ZodLiteral<"gauge">;
|
|
91
|
+
title: z.ZodString;
|
|
92
|
+
value: z.ZodNumber;
|
|
93
|
+
label: z.ZodOptional<z.ZodString>;
|
|
94
|
+
min: z.ZodDefault<z.ZodNumber>;
|
|
95
|
+
max: z.ZodDefault<z.ZodNumber>;
|
|
96
|
+
thresholds: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
97
|
+
value: z.ZodNumber;
|
|
98
|
+
color: z.ZodString;
|
|
99
|
+
}, "strict", z.ZodTypeAny, {
|
|
100
|
+
color: string;
|
|
101
|
+
value: number;
|
|
102
|
+
}, {
|
|
103
|
+
color: string;
|
|
104
|
+
value: number;
|
|
105
|
+
}>, "many">>;
|
|
106
|
+
}, "strict", z.ZodTypeAny, {
|
|
107
|
+
value: number;
|
|
108
|
+
type: "gauge";
|
|
109
|
+
title: string;
|
|
110
|
+
min: number;
|
|
111
|
+
max: number;
|
|
112
|
+
label?: string | undefined;
|
|
113
|
+
thresholds?: {
|
|
114
|
+
color: string;
|
|
115
|
+
value: number;
|
|
116
|
+
}[] | undefined;
|
|
117
|
+
}, {
|
|
118
|
+
value: number;
|
|
119
|
+
type: "gauge";
|
|
120
|
+
title: string;
|
|
121
|
+
label?: string | undefined;
|
|
122
|
+
min?: number | undefined;
|
|
123
|
+
max?: number | undefined;
|
|
124
|
+
thresholds?: {
|
|
125
|
+
color: string;
|
|
126
|
+
value: number;
|
|
127
|
+
}[] | undefined;
|
|
128
|
+
}>]>, "many">;
|
|
129
|
+
layout: z.ZodDefault<z.ZodEnum<["grid", "vertical", "horizontal"]>>;
|
|
130
|
+
} & {
|
|
131
|
+
output_path: z.ZodOptional<z.ZodString>;
|
|
132
|
+
width: z.ZodDefault<z.ZodNumber>;
|
|
133
|
+
height: z.ZodDefault<z.ZodNumber>;
|
|
134
|
+
format: z.ZodDefault<z.ZodEnum<["png", "jpg"]>>;
|
|
135
|
+
}, "strict", z.ZodTypeAny, {
|
|
136
|
+
width: number;
|
|
137
|
+
height: number;
|
|
138
|
+
format: "png" | "jpg";
|
|
139
|
+
title: string;
|
|
140
|
+
layout: "horizontal" | "grid" | "vertical";
|
|
141
|
+
charts: ({
|
|
142
|
+
type: "bar";
|
|
143
|
+
title: string;
|
|
144
|
+
labels: string[];
|
|
145
|
+
datasets: {
|
|
146
|
+
label: string;
|
|
147
|
+
data: number[];
|
|
148
|
+
color?: string | undefined;
|
|
149
|
+
}[];
|
|
150
|
+
} | {
|
|
151
|
+
type: "line";
|
|
152
|
+
title: string;
|
|
153
|
+
labels: string[];
|
|
154
|
+
datasets: {
|
|
155
|
+
label: string;
|
|
156
|
+
data: number[];
|
|
157
|
+
color?: string | undefined;
|
|
158
|
+
}[];
|
|
159
|
+
} | {
|
|
160
|
+
values: number[];
|
|
161
|
+
type: "pie";
|
|
162
|
+
title: string;
|
|
163
|
+
labels: string[];
|
|
164
|
+
} | {
|
|
165
|
+
value: number;
|
|
166
|
+
type: "gauge";
|
|
167
|
+
title: string;
|
|
168
|
+
min: number;
|
|
169
|
+
max: number;
|
|
170
|
+
label?: string | undefined;
|
|
171
|
+
thresholds?: {
|
|
172
|
+
color: string;
|
|
173
|
+
value: number;
|
|
174
|
+
}[] | undefined;
|
|
175
|
+
})[];
|
|
176
|
+
output_path?: string | undefined;
|
|
177
|
+
}, {
|
|
178
|
+
charts: ({
|
|
179
|
+
type: "bar";
|
|
180
|
+
title: string;
|
|
181
|
+
labels: string[];
|
|
182
|
+
datasets: {
|
|
183
|
+
label: string;
|
|
184
|
+
data: number[];
|
|
185
|
+
color?: string | undefined;
|
|
186
|
+
}[];
|
|
187
|
+
} | {
|
|
188
|
+
type: "line";
|
|
189
|
+
title: string;
|
|
190
|
+
labels: string[];
|
|
191
|
+
datasets: {
|
|
192
|
+
label: string;
|
|
193
|
+
data: number[];
|
|
194
|
+
color?: string | undefined;
|
|
195
|
+
}[];
|
|
196
|
+
} | {
|
|
197
|
+
values: number[];
|
|
198
|
+
type: "pie";
|
|
199
|
+
title: string;
|
|
200
|
+
labels: string[];
|
|
201
|
+
} | {
|
|
202
|
+
value: number;
|
|
203
|
+
type: "gauge";
|
|
204
|
+
title: string;
|
|
205
|
+
label?: string | undefined;
|
|
206
|
+
min?: number | undefined;
|
|
207
|
+
max?: number | undefined;
|
|
208
|
+
thresholds?: {
|
|
209
|
+
color: string;
|
|
210
|
+
value: number;
|
|
211
|
+
}[] | undefined;
|
|
212
|
+
})[];
|
|
213
|
+
width?: number | undefined;
|
|
214
|
+
height?: number | undefined;
|
|
215
|
+
output_path?: string | undefined;
|
|
216
|
+
format?: "png" | "jpg" | undefined;
|
|
217
|
+
title?: string | undefined;
|
|
218
|
+
layout?: "horizontal" | "grid" | "vertical" | undefined;
|
|
219
|
+
}>;
|
|
220
|
+
export type ChartMultiInput = z.infer<typeof ChartMultiSchema>;
|
|
221
|
+
export declare const chartMultiTool: {
|
|
222
|
+
name: string;
|
|
223
|
+
title: string;
|
|
224
|
+
description: string;
|
|
225
|
+
inputSchema: z.ZodObject<{
|
|
226
|
+
title: z.ZodDefault<z.ZodString>;
|
|
227
|
+
charts: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
228
|
+
type: z.ZodLiteral<"bar">;
|
|
229
|
+
title: z.ZodString;
|
|
230
|
+
labels: z.ZodArray<z.ZodString, "many">;
|
|
231
|
+
datasets: z.ZodArray<z.ZodObject<{
|
|
232
|
+
label: z.ZodString;
|
|
233
|
+
data: z.ZodArray<z.ZodNumber, "many">;
|
|
234
|
+
color: z.ZodOptional<z.ZodString>;
|
|
235
|
+
}, "strict", z.ZodTypeAny, {
|
|
236
|
+
label: string;
|
|
237
|
+
data: number[];
|
|
238
|
+
color?: string | undefined;
|
|
239
|
+
}, {
|
|
240
|
+
label: string;
|
|
241
|
+
data: number[];
|
|
242
|
+
color?: string | undefined;
|
|
243
|
+
}>, "many">;
|
|
244
|
+
}, "strict", z.ZodTypeAny, {
|
|
245
|
+
type: "bar";
|
|
246
|
+
title: string;
|
|
247
|
+
labels: string[];
|
|
248
|
+
datasets: {
|
|
249
|
+
label: string;
|
|
250
|
+
data: number[];
|
|
251
|
+
color?: string | undefined;
|
|
252
|
+
}[];
|
|
253
|
+
}, {
|
|
254
|
+
type: "bar";
|
|
255
|
+
title: string;
|
|
256
|
+
labels: string[];
|
|
257
|
+
datasets: {
|
|
258
|
+
label: string;
|
|
259
|
+
data: number[];
|
|
260
|
+
color?: string | undefined;
|
|
261
|
+
}[];
|
|
262
|
+
}>, z.ZodObject<{
|
|
263
|
+
type: z.ZodLiteral<"line">;
|
|
264
|
+
title: z.ZodString;
|
|
265
|
+
labels: z.ZodArray<z.ZodString, "many">;
|
|
266
|
+
datasets: z.ZodArray<z.ZodObject<{
|
|
267
|
+
label: z.ZodString;
|
|
268
|
+
data: z.ZodArray<z.ZodNumber, "many">;
|
|
269
|
+
color: z.ZodOptional<z.ZodString>;
|
|
270
|
+
}, "strict", z.ZodTypeAny, {
|
|
271
|
+
label: string;
|
|
272
|
+
data: number[];
|
|
273
|
+
color?: string | undefined;
|
|
274
|
+
}, {
|
|
275
|
+
label: string;
|
|
276
|
+
data: number[];
|
|
277
|
+
color?: string | undefined;
|
|
278
|
+
}>, "many">;
|
|
279
|
+
}, "strict", z.ZodTypeAny, {
|
|
280
|
+
type: "line";
|
|
281
|
+
title: string;
|
|
282
|
+
labels: string[];
|
|
283
|
+
datasets: {
|
|
284
|
+
label: string;
|
|
285
|
+
data: number[];
|
|
286
|
+
color?: string | undefined;
|
|
287
|
+
}[];
|
|
288
|
+
}, {
|
|
289
|
+
type: "line";
|
|
290
|
+
title: string;
|
|
291
|
+
labels: string[];
|
|
292
|
+
datasets: {
|
|
293
|
+
label: string;
|
|
294
|
+
data: number[];
|
|
295
|
+
color?: string | undefined;
|
|
296
|
+
}[];
|
|
297
|
+
}>, z.ZodObject<{
|
|
298
|
+
type: z.ZodLiteral<"pie">;
|
|
299
|
+
title: z.ZodString;
|
|
300
|
+
labels: z.ZodArray<z.ZodString, "many">;
|
|
301
|
+
values: z.ZodArray<z.ZodNumber, "many">;
|
|
302
|
+
}, "strict", z.ZodTypeAny, {
|
|
303
|
+
values: number[];
|
|
304
|
+
type: "pie";
|
|
305
|
+
title: string;
|
|
306
|
+
labels: string[];
|
|
307
|
+
}, {
|
|
308
|
+
values: number[];
|
|
309
|
+
type: "pie";
|
|
310
|
+
title: string;
|
|
311
|
+
labels: string[];
|
|
312
|
+
}>, z.ZodObject<{
|
|
313
|
+
type: z.ZodLiteral<"gauge">;
|
|
314
|
+
title: z.ZodString;
|
|
315
|
+
value: z.ZodNumber;
|
|
316
|
+
label: z.ZodOptional<z.ZodString>;
|
|
317
|
+
min: z.ZodDefault<z.ZodNumber>;
|
|
318
|
+
max: z.ZodDefault<z.ZodNumber>;
|
|
319
|
+
thresholds: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
320
|
+
value: z.ZodNumber;
|
|
321
|
+
color: z.ZodString;
|
|
322
|
+
}, "strict", z.ZodTypeAny, {
|
|
323
|
+
color: string;
|
|
324
|
+
value: number;
|
|
325
|
+
}, {
|
|
326
|
+
color: string;
|
|
327
|
+
value: number;
|
|
328
|
+
}>, "many">>;
|
|
329
|
+
}, "strict", z.ZodTypeAny, {
|
|
330
|
+
value: number;
|
|
331
|
+
type: "gauge";
|
|
332
|
+
title: string;
|
|
333
|
+
min: number;
|
|
334
|
+
max: number;
|
|
335
|
+
label?: string | undefined;
|
|
336
|
+
thresholds?: {
|
|
337
|
+
color: string;
|
|
338
|
+
value: number;
|
|
339
|
+
}[] | undefined;
|
|
340
|
+
}, {
|
|
341
|
+
value: number;
|
|
342
|
+
type: "gauge";
|
|
343
|
+
title: string;
|
|
344
|
+
label?: string | undefined;
|
|
345
|
+
min?: number | undefined;
|
|
346
|
+
max?: number | undefined;
|
|
347
|
+
thresholds?: {
|
|
348
|
+
color: string;
|
|
349
|
+
value: number;
|
|
350
|
+
}[] | undefined;
|
|
351
|
+
}>]>, "many">;
|
|
352
|
+
layout: z.ZodDefault<z.ZodEnum<["grid", "vertical", "horizontal"]>>;
|
|
353
|
+
} & {
|
|
354
|
+
output_path: z.ZodOptional<z.ZodString>;
|
|
355
|
+
width: z.ZodDefault<z.ZodNumber>;
|
|
356
|
+
height: z.ZodDefault<z.ZodNumber>;
|
|
357
|
+
format: z.ZodDefault<z.ZodEnum<["png", "jpg"]>>;
|
|
358
|
+
}, "strict", z.ZodTypeAny, {
|
|
359
|
+
width: number;
|
|
360
|
+
height: number;
|
|
361
|
+
format: "png" | "jpg";
|
|
362
|
+
title: string;
|
|
363
|
+
layout: "horizontal" | "grid" | "vertical";
|
|
364
|
+
charts: ({
|
|
365
|
+
type: "bar";
|
|
366
|
+
title: string;
|
|
367
|
+
labels: string[];
|
|
368
|
+
datasets: {
|
|
369
|
+
label: string;
|
|
370
|
+
data: number[];
|
|
371
|
+
color?: string | undefined;
|
|
372
|
+
}[];
|
|
373
|
+
} | {
|
|
374
|
+
type: "line";
|
|
375
|
+
title: string;
|
|
376
|
+
labels: string[];
|
|
377
|
+
datasets: {
|
|
378
|
+
label: string;
|
|
379
|
+
data: number[];
|
|
380
|
+
color?: string | undefined;
|
|
381
|
+
}[];
|
|
382
|
+
} | {
|
|
383
|
+
values: number[];
|
|
384
|
+
type: "pie";
|
|
385
|
+
title: string;
|
|
386
|
+
labels: string[];
|
|
387
|
+
} | {
|
|
388
|
+
value: number;
|
|
389
|
+
type: "gauge";
|
|
390
|
+
title: string;
|
|
391
|
+
min: number;
|
|
392
|
+
max: number;
|
|
393
|
+
label?: string | undefined;
|
|
394
|
+
thresholds?: {
|
|
395
|
+
color: string;
|
|
396
|
+
value: number;
|
|
397
|
+
}[] | undefined;
|
|
398
|
+
})[];
|
|
399
|
+
output_path?: string | undefined;
|
|
400
|
+
}, {
|
|
401
|
+
charts: ({
|
|
402
|
+
type: "bar";
|
|
403
|
+
title: string;
|
|
404
|
+
labels: string[];
|
|
405
|
+
datasets: {
|
|
406
|
+
label: string;
|
|
407
|
+
data: number[];
|
|
408
|
+
color?: string | undefined;
|
|
409
|
+
}[];
|
|
410
|
+
} | {
|
|
411
|
+
type: "line";
|
|
412
|
+
title: string;
|
|
413
|
+
labels: string[];
|
|
414
|
+
datasets: {
|
|
415
|
+
label: string;
|
|
416
|
+
data: number[];
|
|
417
|
+
color?: string | undefined;
|
|
418
|
+
}[];
|
|
419
|
+
} | {
|
|
420
|
+
values: number[];
|
|
421
|
+
type: "pie";
|
|
422
|
+
title: string;
|
|
423
|
+
labels: string[];
|
|
424
|
+
} | {
|
|
425
|
+
value: number;
|
|
426
|
+
type: "gauge";
|
|
427
|
+
title: string;
|
|
428
|
+
label?: string | undefined;
|
|
429
|
+
min?: number | undefined;
|
|
430
|
+
max?: number | undefined;
|
|
431
|
+
thresholds?: {
|
|
432
|
+
color: string;
|
|
433
|
+
value: number;
|
|
434
|
+
}[] | undefined;
|
|
435
|
+
})[];
|
|
436
|
+
width?: number | undefined;
|
|
437
|
+
height?: number | undefined;
|
|
438
|
+
output_path?: string | undefined;
|
|
439
|
+
format?: "png" | "jpg" | undefined;
|
|
440
|
+
title?: string | undefined;
|
|
441
|
+
layout?: "horizontal" | "grid" | "vertical" | undefined;
|
|
442
|
+
}>;
|
|
443
|
+
annotations: {
|
|
444
|
+
readOnlyHint: boolean;
|
|
445
|
+
destructiveHint: boolean;
|
|
446
|
+
idempotentHint: boolean;
|
|
447
|
+
openWorldHint: boolean;
|
|
448
|
+
};
|
|
449
|
+
};
|
|
450
|
+
export declare function executeChartMulti(params: ChartMultiInput): Promise<{
|
|
451
|
+
content: {
|
|
452
|
+
type: "text";
|
|
453
|
+
text: string;
|
|
454
|
+
}[];
|
|
455
|
+
isError: boolean;
|
|
456
|
+
} | {
|
|
457
|
+
content: ({
|
|
458
|
+
type: "text";
|
|
459
|
+
text: string;
|
|
460
|
+
} | {
|
|
461
|
+
type: "image";
|
|
462
|
+
data: string;
|
|
463
|
+
mimeType: "image/png" | "image/jpeg";
|
|
464
|
+
})[];
|
|
465
|
+
isError?: undefined;
|
|
466
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{z}from"zod";import{renderChart}from"../../chart-engine.js";import{BaseChartParams,ChartDatasetSchema,GaugeThresholdSchema}from"../../schemas.js";const SubChartSchema=z.discriminatedUnion("type",[z.object({type:z.literal("bar"),title:z.string(),labels:z.array(z.string()),datasets:z.array(ChartDatasetSchema)}).strict(),z.object({type:z.literal("line"),title:z.string(),labels:z.array(z.string()),datasets:z.array(ChartDatasetSchema)}).strict(),z.object({type:z.literal("pie"),title:z.string(),labels:z.array(z.string()),values:z.array(z.number())}).strict(),z.object({type:z.literal("gauge"),title:z.string(),value:z.number(),label:z.string().optional(),min:z.number().default(0),max:z.number().default(100),thresholds:z.array(GaugeThresholdSchema).optional()}).strict()]);export const ChartMultiSchema=z.object({title:z.string().default("Dashboard").describe("Overall title"),charts:z.array(SubChartSchema).min(1).max(9).describe("Array of sub-chart configs"),layout:z.enum(["grid","vertical","horizontal"]).default("grid").describe("Layout mode")}).merge(BaseChartParams).strict();export const chartMultiTool={name:"chart_multi",title:"Multi Chart Dashboard",description:"Generate multiple charts arranged in a grid/vertical/horizontal layout as a single image. Supports bar, line, pie, and gauge sub-charts (max 9).",inputSchema:ChartMultiSchema,annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}};export async function executeChartMulti(t){const e=t.charts.length;let a,r;"vertical"===t.layout?(a=1,r=e):"horizontal"===t.layout?(a=e,r=1):(a=Math.ceil(Math.sqrt(e)),r=Math.ceil(e/a));const i=Math.floor(t.width/a),l=Math.floor(t.height/r),o=[];for(let e=0;e<t.charts.length;e++){const a=t.charts[e],r=a.title||`Chart ${e+1}`;let s;if("bar"===a.type||"line"===a.type){const{getSeriesColor:t,withAlpha:e}=await import("../../colors.js");s={type:a.type,data:{labels:a.labels,datasets:a.datasets.map((r,i)=>{const l=r.color||t(i);return{label:r.label,data:r.data,backgroundColor:e(l,.7),borderColor:l,borderWidth:1,..."line"===a.type?{tension:.3,pointRadius:3,fill:!1}:{}}})},options:{responsive:!1,plugins:{title:{display:!0,text:r,font:{size:14}},legend:{display:!0}}}}}else if("pie"===a.type){const{getSeriesColor:t,withAlpha:e}=await import("../../colors.js");s={type:"pie",data:{labels:a.labels,datasets:[{data:a.values,backgroundColor:a.labels.map((a,r)=>e(t(r),.8))}]},options:{responsive:!1,plugins:{title:{display:!0,text:r,font:{size:14}},legend:{display:!0,position:"right"}}}}}else if("gauge"===a.type){const t=a.max-a.min,e=Math.max(a.min,Math.min(a.max,a.value))-a.min;s={type:"doughnut",data:{labels:[a.label||"Value","Remaining"],datasets:[{data:[e,t-e],backgroundColor:["#4CAF50","#E0E0E0"],borderWidth:0}]},options:{responsive:!1,circumference:270,rotation:225,cutout:"75%",plugins:{title:{display:!0,text:`${r}: ${a.value.toFixed(1)}%`,font:{size:14}},legend:{display:!1}}}}}if(s){const a=await renderChart(s,{width:i,height:l,format:t.format,outputPath:void 0,title:`${t.title}-${e+1}-${r}`});o.push(a)}}if(0===o.length)return{content:[{type:"text",text:"No charts generated."}],isError:!0};const s=[];s.push({type:"text",text:`Dashboard "${t.title}" — ${o.length} charts generated (${t.layout} layout):\n`+o.map((t,e)=>` ${e+1}. ${t.filePath} (${t.width}x${t.height})`).join("\n")});for(const t of o)s.push({type:"image",data:t.base64,mimeType:t.mimeType});return{content:s}}
|