mcp-server-esa 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.prettierignore +4 -0
- package/.prettierrc +3 -0
- package/abc.json +8 -0
- package/dist/721.js +305 -0
- package/dist/721.mjs +304 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +7475 -0
- package/dist/index.js.LICENSE.txt +27 -0
- package/dist/index.mjs +7448 -0
- package/dist/index.mjs.LICENSE.txt +27 -0
- package/dist/tools/commit.d.ts +9 -0
- package/dist/tools/deploy.d.ts +17 -0
- package/dist/tools/deployments.d.ts +9 -0
- package/dist/tools/list-esa-function.d.ts +26 -0
- package/dist/tools/record.d.ts +25 -0
- package/dist/tools/route.d.ts +49 -0
- package/dist/tools/routine.d.ts +33 -0
- package/dist/tools/site.d.ts +17 -0
- package/dist/utils/helpers.d.ts +25 -0
- package/dist/utils/service.d.ts +39 -0
- package/dist/utils/types.d.ts +59 -0
- package/esa.toml +8 -0
- package/eslint.config.mjs +10 -0
- package/image/readme/1744114566511.png +0 -0
- package/image/readme/1744114625974.png +0 -0
- package/image/readme/1744165412296.png +0 -0
- package/image/readme/1744168230082.gif +0 -0
- package/image/readme/1744168440370.gif +0 -0
- package/image/readme/1744168966418.gif +0 -0
- package/package.json +46 -0
- package/readme.md +281 -0
- package/rslib.config.ts +15 -0
- package/src/index.ts +48 -0
- package/src/tools/commit.ts +90 -0
- package/src/tools/deploy.ts +103 -0
- package/src/tools/deployments.ts +37 -0
- package/src/tools/list-esa-function.ts +92 -0
- package/src/tools/record.ts +115 -0
- package/src/tools/route.ts +314 -0
- package/src/tools/routine.ts +130 -0
- package/src/tools/site.ts +61 -0
- package/src/utils/helpers.ts +181 -0
- package/src/utils/service.ts +337 -0
- package/src/utils/types.ts +71 -0
- package/test.js +0 -0
- package/tsconfig.json +16 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { CallToolRequest, Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import api from '../utils/service.js';
|
|
3
|
+
import {
|
|
4
|
+
CreateRoutineRelatedRecordRequest,
|
|
5
|
+
DeleteRoutineRelatedRecordRequest,
|
|
6
|
+
} from '@alicloud/esa20240910';
|
|
7
|
+
import { ListRoutineRelatedRecordsRequest } from '../utils/types.js';
|
|
8
|
+
|
|
9
|
+
export const RECORD_CREATE_TOOL: Tool = {
|
|
10
|
+
name: 'record_create',
|
|
11
|
+
description: 'Create a record',
|
|
12
|
+
inputSchema: {
|
|
13
|
+
type: 'object',
|
|
14
|
+
properties: {
|
|
15
|
+
name: {
|
|
16
|
+
type: 'string',
|
|
17
|
+
description: 'The name of the routine',
|
|
18
|
+
},
|
|
19
|
+
siteId: {
|
|
20
|
+
type: 'number',
|
|
21
|
+
description: 'The ID of the site',
|
|
22
|
+
},
|
|
23
|
+
recordName: {
|
|
24
|
+
type: 'string',
|
|
25
|
+
description: 'The name of the record',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
required: ['name', 'siteId', 'recordName'],
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const RECORD_DELETE_TOOL: Tool = {
|
|
33
|
+
name: 'record_delete',
|
|
34
|
+
description: 'Delete a record',
|
|
35
|
+
inputSchema: {
|
|
36
|
+
type: 'object',
|
|
37
|
+
properties: {
|
|
38
|
+
name: {
|
|
39
|
+
type: 'string',
|
|
40
|
+
description: 'The name of the routine',
|
|
41
|
+
},
|
|
42
|
+
recordId: {
|
|
43
|
+
type: 'number',
|
|
44
|
+
description: 'The ID of the record',
|
|
45
|
+
},
|
|
46
|
+
siteId: {
|
|
47
|
+
type: 'number',
|
|
48
|
+
description: 'The ID of the site',
|
|
49
|
+
},
|
|
50
|
+
recordName: {
|
|
51
|
+
type: 'string',
|
|
52
|
+
description: 'The name of the record',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
required: ['name', 'siteId', 'recordName'],
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export const RECORD_LIST_TOOL: Tool = {
|
|
60
|
+
name: 'record_list',
|
|
61
|
+
description: 'List all records',
|
|
62
|
+
inputSchema: {
|
|
63
|
+
type: 'object',
|
|
64
|
+
properties: {
|
|
65
|
+
Name: {
|
|
66
|
+
type: 'string',
|
|
67
|
+
description: 'The name of the routine',
|
|
68
|
+
},
|
|
69
|
+
PageNumber: {
|
|
70
|
+
type: 'number',
|
|
71
|
+
description: 'The page number of the records',
|
|
72
|
+
},
|
|
73
|
+
PageSize: {
|
|
74
|
+
type: 'number',
|
|
75
|
+
description: 'The page size of the records',
|
|
76
|
+
},
|
|
77
|
+
SearchKeyWord: {
|
|
78
|
+
type: 'string',
|
|
79
|
+
description: 'The search key word of the records',
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
required: ['Name'],
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export const record_create = async (request: CallToolRequest) => {
|
|
87
|
+
const res = await api.createRoutineRelatedRecord(
|
|
88
|
+
request.params.arguments as CreateRoutineRelatedRecordRequest,
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
return {
|
|
92
|
+
content: [{ type: 'text', text: JSON.stringify(res) }],
|
|
93
|
+
success: true,
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export const record_delete = async (request: CallToolRequest) => {
|
|
98
|
+
const res = await api.deleteRoutineRelatedRecord(
|
|
99
|
+
request.params.arguments as DeleteRoutineRelatedRecordRequest,
|
|
100
|
+
);
|
|
101
|
+
return {
|
|
102
|
+
content: [{ type: 'text', text: JSON.stringify(res) }],
|
|
103
|
+
success: true,
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export const record_list = async (request: CallToolRequest) => {
|
|
108
|
+
const res = await api.listRoutineRelatedRecords(
|
|
109
|
+
request.params.arguments as unknown as ListRoutineRelatedRecordsRequest,
|
|
110
|
+
);
|
|
111
|
+
return {
|
|
112
|
+
content: [{ type: 'text', text: JSON.stringify(res) }],
|
|
113
|
+
success: true,
|
|
114
|
+
};
|
|
115
|
+
};
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
import { CallToolRequest, Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import api from '../utils/service.js';
|
|
3
|
+
import {
|
|
4
|
+
CreateRoutineRouteRequest,
|
|
5
|
+
DeleteRoutineRouteRequest,
|
|
6
|
+
GetRoutineRouteRequest,
|
|
7
|
+
ListRoutineRoutesRequest,
|
|
8
|
+
ListSiteRoutesRequest,
|
|
9
|
+
UpdateRoutineRouteRequest,
|
|
10
|
+
} from '@alicloud/esa20240910';
|
|
11
|
+
import { transferRouteToRuleString } from '../utils/helpers.js';
|
|
12
|
+
|
|
13
|
+
export const ROUTE_CREATE_TOOL: Tool = {
|
|
14
|
+
name: 'route_create',
|
|
15
|
+
description: 'Create a edge routine(ER) related route',
|
|
16
|
+
inputSchema: {
|
|
17
|
+
type: 'object',
|
|
18
|
+
properties: {
|
|
19
|
+
siteId: {
|
|
20
|
+
type: 'number',
|
|
21
|
+
description: 'The ID of the site',
|
|
22
|
+
},
|
|
23
|
+
mode: {
|
|
24
|
+
type: 'enum',
|
|
25
|
+
enum: ['simple', 'custom'],
|
|
26
|
+
description: 'The mode of the route, default is simple',
|
|
27
|
+
},
|
|
28
|
+
route: {
|
|
29
|
+
type: 'string',
|
|
30
|
+
description:
|
|
31
|
+
'The route of the route, if mode is simple, this field is required',
|
|
32
|
+
},
|
|
33
|
+
rule: {
|
|
34
|
+
type: 'string',
|
|
35
|
+
description:
|
|
36
|
+
'The rule of the route, if mode is custom, this field is required',
|
|
37
|
+
},
|
|
38
|
+
routineName: {
|
|
39
|
+
type: 'string',
|
|
40
|
+
description: 'The name of the routine',
|
|
41
|
+
},
|
|
42
|
+
routeName: {
|
|
43
|
+
type: 'string',
|
|
44
|
+
description: 'The name of the route, use to identify the route',
|
|
45
|
+
},
|
|
46
|
+
bypass: {
|
|
47
|
+
type: 'enum',
|
|
48
|
+
enum: ['on', 'off'],
|
|
49
|
+
description: 'The bypass of the route, default is off',
|
|
50
|
+
},
|
|
51
|
+
routeEnable: {
|
|
52
|
+
type: 'enum',
|
|
53
|
+
enum: ['on', 'off'],
|
|
54
|
+
description: 'The enable of the route, default is on',
|
|
55
|
+
},
|
|
56
|
+
sequence: {
|
|
57
|
+
type: 'number',
|
|
58
|
+
description:
|
|
59
|
+
'The sequence of the route, if not passed, default is the current number of routes',
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
required: [
|
|
63
|
+
'siteId',
|
|
64
|
+
'mode',
|
|
65
|
+
'rule',
|
|
66
|
+
'routineName',
|
|
67
|
+
'routeName',
|
|
68
|
+
'bypass',
|
|
69
|
+
'routeEnable',
|
|
70
|
+
],
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const ROUTE_UPDATE_TOOL: Tool = {
|
|
75
|
+
name: 'route_update',
|
|
76
|
+
description: 'Update a routine related route',
|
|
77
|
+
inputSchema: {
|
|
78
|
+
type: 'object',
|
|
79
|
+
properties: {
|
|
80
|
+
siteId: {
|
|
81
|
+
type: 'number',
|
|
82
|
+
description: 'The ID of the site',
|
|
83
|
+
},
|
|
84
|
+
configId: {
|
|
85
|
+
type: 'number',
|
|
86
|
+
description: 'The ID of the config',
|
|
87
|
+
},
|
|
88
|
+
routeName: {
|
|
89
|
+
type: 'string',
|
|
90
|
+
description: 'The name of the route, use to identify the route',
|
|
91
|
+
},
|
|
92
|
+
routeEnable: {
|
|
93
|
+
type: 'enum',
|
|
94
|
+
enum: ['on', 'off'],
|
|
95
|
+
description: 'The enable of the route',
|
|
96
|
+
},
|
|
97
|
+
rule: {
|
|
98
|
+
type: 'string',
|
|
99
|
+
description: 'The rule of the route',
|
|
100
|
+
},
|
|
101
|
+
routineName: {
|
|
102
|
+
type: 'string',
|
|
103
|
+
description: 'The name of the routine',
|
|
104
|
+
},
|
|
105
|
+
bypass: {
|
|
106
|
+
type: 'enum',
|
|
107
|
+
enum: ['on', 'off'],
|
|
108
|
+
description: 'The bypass of the route ',
|
|
109
|
+
},
|
|
110
|
+
sequence: {
|
|
111
|
+
type: 'number',
|
|
112
|
+
description:
|
|
113
|
+
'The sequence of the route, if not passed, default is the current number of routes',
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
required: [
|
|
117
|
+
'siteId',
|
|
118
|
+
'configId',
|
|
119
|
+
'routeName',
|
|
120
|
+
'routeEnable',
|
|
121
|
+
'rule',
|
|
122
|
+
'routineName',
|
|
123
|
+
'bypass',
|
|
124
|
+
],
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
export const ROUTE_DELETE_TOOL: Tool = {
|
|
129
|
+
name: 'route_delete',
|
|
130
|
+
description: 'Delete a routine related route',
|
|
131
|
+
inputSchema: {
|
|
132
|
+
type: 'object',
|
|
133
|
+
properties: {
|
|
134
|
+
siteId: {
|
|
135
|
+
type: 'number',
|
|
136
|
+
description: 'The ID of the site',
|
|
137
|
+
},
|
|
138
|
+
configId: {
|
|
139
|
+
type: 'number',
|
|
140
|
+
description: 'The ID of the config',
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
required: ['siteId', 'configId'],
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
export const ROUTE_GET_TOOL: Tool = {
|
|
148
|
+
name: 'route_get',
|
|
149
|
+
description: 'Get a routine related route',
|
|
150
|
+
inputSchema: {
|
|
151
|
+
type: 'object',
|
|
152
|
+
properties: {
|
|
153
|
+
siteId: {
|
|
154
|
+
type: 'number',
|
|
155
|
+
description: 'The ID of the site',
|
|
156
|
+
},
|
|
157
|
+
configId: {
|
|
158
|
+
type: 'number',
|
|
159
|
+
description: 'The ID of the config',
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
required: ['siteId', 'configId'],
|
|
163
|
+
},
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
export const ROUTINE_ROUTE_LIST_TOOL: Tool = {
|
|
167
|
+
name: 'routine_route_list',
|
|
168
|
+
description: 'List all routes of a routine',
|
|
169
|
+
inputSchema: {
|
|
170
|
+
type: 'object',
|
|
171
|
+
properties: {
|
|
172
|
+
routineName: {
|
|
173
|
+
type: 'string',
|
|
174
|
+
description: 'The name of the routine',
|
|
175
|
+
},
|
|
176
|
+
routeName: {
|
|
177
|
+
type: 'string',
|
|
178
|
+
description: 'The name of the route, use to filter list results',
|
|
179
|
+
},
|
|
180
|
+
|
|
181
|
+
pageNumber: {
|
|
182
|
+
type: 'number',
|
|
183
|
+
description: 'The page number of the routes',
|
|
184
|
+
},
|
|
185
|
+
pageSize: {
|
|
186
|
+
type: 'number',
|
|
187
|
+
description: 'The page size of the routes',
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
required: ['routineName'],
|
|
191
|
+
},
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
// export interface ListSiteRoutesReq {
|
|
195
|
+
// SiteId: number;
|
|
196
|
+
// ConfigId?: number;
|
|
197
|
+
// ConfigType?: string;
|
|
198
|
+
// RouteName?: string;
|
|
199
|
+
// PageNumber?: number;
|
|
200
|
+
// PageSize?: number;
|
|
201
|
+
// RegionId?: string;
|
|
202
|
+
// }
|
|
203
|
+
|
|
204
|
+
export const SITE_ROUTE_LIST_TOOL: Tool = {
|
|
205
|
+
name: 'site_route_list',
|
|
206
|
+
description: 'List all routes of a site',
|
|
207
|
+
inputSchema: {
|
|
208
|
+
type: 'object',
|
|
209
|
+
properties: {
|
|
210
|
+
siteId: {
|
|
211
|
+
type: 'number',
|
|
212
|
+
description: 'The ID of the site',
|
|
213
|
+
},
|
|
214
|
+
routeName: {
|
|
215
|
+
type: 'string',
|
|
216
|
+
description: 'The name of the route, use to filter list results',
|
|
217
|
+
},
|
|
218
|
+
|
|
219
|
+
pageNumber: {
|
|
220
|
+
type: 'number',
|
|
221
|
+
description: 'The page number of the routes',
|
|
222
|
+
},
|
|
223
|
+
pageSize: {
|
|
224
|
+
type: 'number',
|
|
225
|
+
description: 'The page size of the routes',
|
|
226
|
+
},
|
|
227
|
+
},
|
|
228
|
+
required: ['siteId'],
|
|
229
|
+
},
|
|
230
|
+
};
|
|
231
|
+
export const route_create = async (request: CallToolRequest) => {
|
|
232
|
+
const { mode, route } = request.params.arguments as CreateRoutineRouteRequest;
|
|
233
|
+
|
|
234
|
+
if (mode === 'simple') {
|
|
235
|
+
const res = await api.createRoutineRoute({
|
|
236
|
+
...request.params.arguments,
|
|
237
|
+
rule: transferRouteToRuleString(route),
|
|
238
|
+
} as unknown as CreateRoutineRouteRequest);
|
|
239
|
+
return {
|
|
240
|
+
content: [{ type: 'text', text: JSON.stringify(res) }],
|
|
241
|
+
success: true,
|
|
242
|
+
};
|
|
243
|
+
} else {
|
|
244
|
+
const res = await api.createRoutineRoute(
|
|
245
|
+
request.params.arguments as CreateRoutineRouteRequest,
|
|
246
|
+
);
|
|
247
|
+
return {
|
|
248
|
+
content: [{ type: 'text', text: JSON.stringify(res) }],
|
|
249
|
+
success: true,
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
export const route_delete = async (request: CallToolRequest) => {
|
|
255
|
+
const res = await api.deleteRoutineRoute(
|
|
256
|
+
request.params.arguments as DeleteRoutineRouteRequest,
|
|
257
|
+
);
|
|
258
|
+
return {
|
|
259
|
+
content: [{ type: 'text', text: JSON.stringify(res) }],
|
|
260
|
+
success: true,
|
|
261
|
+
};
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
export const route_update = async (request: CallToolRequest) => {
|
|
265
|
+
const { mode, route } = request.params.arguments as CreateRoutineRouteRequest;
|
|
266
|
+
if (mode === 'simple') {
|
|
267
|
+
const res = await api.updateRoutineRoute({
|
|
268
|
+
...request.params.arguments,
|
|
269
|
+
rule: transferRouteToRuleString(route),
|
|
270
|
+
} as unknown as UpdateRoutineRouteRequest);
|
|
271
|
+
return {
|
|
272
|
+
content: [{ type: 'text', text: JSON.stringify(res) }],
|
|
273
|
+
success: true,
|
|
274
|
+
};
|
|
275
|
+
} else {
|
|
276
|
+
const res = await api.updateRoutineRoute(
|
|
277
|
+
request.params.arguments as UpdateRoutineRouteRequest,
|
|
278
|
+
);
|
|
279
|
+
return {
|
|
280
|
+
content: [{ type: 'text', text: JSON.stringify(res) }],
|
|
281
|
+
success: true,
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
export const route_get = async (request: CallToolRequest) => {
|
|
287
|
+
const res = await api.getRoutineRoute(
|
|
288
|
+
request.params.arguments as GetRoutineRouteRequest,
|
|
289
|
+
);
|
|
290
|
+
return {
|
|
291
|
+
content: [{ type: 'text', text: JSON.stringify(res) }],
|
|
292
|
+
success: true,
|
|
293
|
+
};
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
export const routine_route_list = async (request: CallToolRequest) => {
|
|
297
|
+
const res = await api.listRoutineRoutes(
|
|
298
|
+
request.params.arguments as ListRoutineRoutesRequest,
|
|
299
|
+
);
|
|
300
|
+
return {
|
|
301
|
+
content: [{ type: 'text', text: JSON.stringify(res) }],
|
|
302
|
+
success: true,
|
|
303
|
+
};
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
export const site_route_list = async (request: CallToolRequest) => {
|
|
307
|
+
const res = await api.listSiteRoutes(
|
|
308
|
+
request.params.arguments as ListSiteRoutesRequest,
|
|
309
|
+
);
|
|
310
|
+
return {
|
|
311
|
+
content: [{ type: 'text', text: JSON.stringify(res) }],
|
|
312
|
+
success: true,
|
|
313
|
+
};
|
|
314
|
+
};
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { CallToolRequest, Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import api from '../utils/service.js';
|
|
3
|
+
import {
|
|
4
|
+
CreateRoutineRequest,
|
|
5
|
+
DeleteRoutineRequest,
|
|
6
|
+
GetRoutineRequest,
|
|
7
|
+
} from '@alicloud/esa20240910';
|
|
8
|
+
|
|
9
|
+
export const ROUTINE_CREATE_TOOL: Tool = {
|
|
10
|
+
name: 'routine_create',
|
|
11
|
+
description: 'Create a edge routine(ER).',
|
|
12
|
+
inputSchema: {
|
|
13
|
+
type: 'object',
|
|
14
|
+
properties: {
|
|
15
|
+
name: {
|
|
16
|
+
type: 'string',
|
|
17
|
+
description:
|
|
18
|
+
'The name of the routine, support lowercase English, numbers, and hyphens, must start with lowercase English, length cannot be less than 2 characters',
|
|
19
|
+
},
|
|
20
|
+
description: {
|
|
21
|
+
type: 'string',
|
|
22
|
+
description: 'Description of the routine, no spaces',
|
|
23
|
+
},
|
|
24
|
+
code: {
|
|
25
|
+
type: 'string',
|
|
26
|
+
description:
|
|
27
|
+
'Source Code of the routine, export default { async fetch(request) { return handleRequest(request); } }',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
required: ['name', 'code'],
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const ROUTINE_DELETE_TOOL: Tool = {
|
|
35
|
+
name: 'routine_delete',
|
|
36
|
+
description: 'Delete a edge routine(ER).',
|
|
37
|
+
inputSchema: {
|
|
38
|
+
type: 'object',
|
|
39
|
+
properties: {
|
|
40
|
+
name: {
|
|
41
|
+
type: 'string',
|
|
42
|
+
description: 'The name of the routine to delete',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
required: ['name'],
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const ROUTINE_LIST_TOOL: Tool = {
|
|
50
|
+
name: 'routine_list',
|
|
51
|
+
description: 'List all edge routines',
|
|
52
|
+
inputSchema: {
|
|
53
|
+
type: 'object',
|
|
54
|
+
properties: {},
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const ROUTINE_GET_TOOL: Tool = {
|
|
59
|
+
name: 'routine_get',
|
|
60
|
+
description: 'Get a edge routine detail by name',
|
|
61
|
+
inputSchema: {
|
|
62
|
+
type: 'object',
|
|
63
|
+
properties: {
|
|
64
|
+
name: {
|
|
65
|
+
type: 'string',
|
|
66
|
+
description: 'The name of the routine to get details for',
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
required: ['name'],
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export const routine_create = async (request: CallToolRequest) => {
|
|
74
|
+
const res = await api.createRoutine(
|
|
75
|
+
request.params.arguments as CreateRoutineRequest,
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
return {
|
|
79
|
+
content: [
|
|
80
|
+
{
|
|
81
|
+
type: 'text',
|
|
82
|
+
text: JSON.stringify(res),
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
success: true,
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export const routine_delete = async (request: CallToolRequest) => {
|
|
90
|
+
const res = await api.deleteRoutine(
|
|
91
|
+
request.params.arguments as DeleteRoutineRequest,
|
|
92
|
+
);
|
|
93
|
+
return {
|
|
94
|
+
content: [
|
|
95
|
+
{
|
|
96
|
+
type: 'text',
|
|
97
|
+
text: JSON.stringify(res),
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
success: true,
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
export const routine_list = async () => {
|
|
105
|
+
const res = await api.getRoutineUserInfo();
|
|
106
|
+
return {
|
|
107
|
+
content: [
|
|
108
|
+
{
|
|
109
|
+
type: 'text',
|
|
110
|
+
text: JSON.stringify(res),
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
success: true,
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export const routine_get = async (request: CallToolRequest) => {
|
|
118
|
+
const res = await api.getRoutine(
|
|
119
|
+
request.params.arguments as GetRoutineRequest,
|
|
120
|
+
);
|
|
121
|
+
return {
|
|
122
|
+
content: [
|
|
123
|
+
{
|
|
124
|
+
type: 'text',
|
|
125
|
+
text: JSON.stringify(res),
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
success: true,
|
|
129
|
+
};
|
|
130
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { CallToolRequest, Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import api from '../utils/service.js';
|
|
3
|
+
import { ListSitesRequest } from '@alicloud/esa20240910';
|
|
4
|
+
import { GetMatchSiteRequest } from '../utils/types.js';
|
|
5
|
+
|
|
6
|
+
export const SITE_ACTIVE_LIST_TOOL: Tool = {
|
|
7
|
+
name: 'site_active_list',
|
|
8
|
+
description: 'List all active sites',
|
|
9
|
+
inputSchema: {
|
|
10
|
+
type: 'object',
|
|
11
|
+
properties: {},
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const SITE_MATCH_TOOL: Tool = {
|
|
16
|
+
name: 'site_match',
|
|
17
|
+
description: 'Check which site under the account matches the user input',
|
|
18
|
+
inputSchema: {
|
|
19
|
+
type: 'object',
|
|
20
|
+
properties: {
|
|
21
|
+
recordName: {
|
|
22
|
+
type: 'string',
|
|
23
|
+
description: 'The name of the site to match',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
required: ['recordName'],
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const site_active_list = async () => {
|
|
31
|
+
const res = await api.listSites({
|
|
32
|
+
siteSearchType: 'fuzzy',
|
|
33
|
+
status: 'active',
|
|
34
|
+
pageNumber: 1,
|
|
35
|
+
pageSize: 500,
|
|
36
|
+
} as ListSitesRequest);
|
|
37
|
+
return {
|
|
38
|
+
content: [
|
|
39
|
+
{
|
|
40
|
+
type: 'text',
|
|
41
|
+
text: JSON.stringify(res),
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
success: true,
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const site_match = async (request: CallToolRequest) => {
|
|
49
|
+
const res = await api.getMatchSite({
|
|
50
|
+
recordName: request.params.arguments?.recordName ?? '',
|
|
51
|
+
} as GetMatchSiteRequest);
|
|
52
|
+
return {
|
|
53
|
+
content: [
|
|
54
|
+
{
|
|
55
|
+
type: 'text',
|
|
56
|
+
text: JSON.stringify(res),
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
success: true,
|
|
60
|
+
};
|
|
61
|
+
};
|