mcp-server-esa 1.0.7 → 1.0.8

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/dist/index.js CHANGED
@@ -29,71 +29,6 @@ const esa20240910_namespaceObject = require("@alicloud/esa20240910");
29
29
  var esa20240910_default = /*#__PURE__*/ __webpack_require__.n(esa20240910_namespaceObject);
30
30
  const openapi_client_namespaceObject = require("@alicloud/openapi-client");
31
31
  const tea_util_namespaceObject = require("@alicloud/tea-util");
32
- const external_form_data_namespaceObject = require("form-data");
33
- var external_form_data_default = /*#__PURE__*/ __webpack_require__.n(external_form_data_namespaceObject);
34
- const external_node_fetch_namespaceObject = require("node-fetch");
35
- var external_node_fetch_default = /*#__PURE__*/ __webpack_require__.n(external_node_fetch_namespaceObject);
36
- function log(...args) {
37
- const msg = `[DEBUG ${new Date().toISOString()}] ${args.join(' ')}\n`;
38
- process.stderr.write(msg);
39
- }
40
- const uploadCodeToOSS = async (res, code)=>{
41
- var _res_body;
42
- const ossConfig = null == res ? void 0 : null === (_res_body = res.body) || void 0 === _res_body ? void 0 : _res_body.ossPostConfig;
43
- if (200 !== res.statusCode || !ossConfig) return false;
44
- const { OSSAccessKeyId, Signature, callback, Url, key, policy } = ossConfig;
45
- const formData = new (external_form_data_default())();
46
- formData.append('OSSAccessKeyId', OSSAccessKeyId);
47
- formData.append('Signature', Signature);
48
- formData.append('callback', callback);
49
- formData.append("x:codeDescription", ossConfig["x:codeDescription"]);
50
- formData.append('policy', policy);
51
- formData.append('key', key);
52
- formData.append('file', code);
53
- const ossRes = await external_node_fetch_default()(Url, {
54
- method: 'POST',
55
- body: formData,
56
- headers: formData.getHeaders()
57
- });
58
- return ossRes && 200 === ossRes.status;
59
- };
60
- const RuleMatchTypeHost = 'http.host';
61
- const RuleMatchTypeUriPath = 'http.request.uri.path';
62
- const RuleMatchOperatorEq = "eq";
63
- const RuleMatchOperatorStartsWith = "starts_with";
64
- const RuleMatchOperatorEndsWith = "ends_with";
65
- const transferRouteToRuleString = (routePath)=>{
66
- if (!routePath) return '';
67
- const index = routePath.indexOf('/');
68
- let host = '';
69
- let uriPath = '';
70
- if (index < 0) {
71
- host = routePath;
72
- uriPath = '/';
73
- } else {
74
- host = routePath.substring(0, index);
75
- uriPath = routePath.substring(index);
76
- }
77
- let hostOperator = RuleMatchOperatorEq;
78
- if (host.startsWith('*')) {
79
- hostOperator = RuleMatchOperatorEndsWith;
80
- host = host.replace(/\*/g, '');
81
- }
82
- let uriPathOperator = RuleMatchOperatorEq;
83
- if (uriPath.endsWith('*')) {
84
- uriPathOperator = RuleMatchOperatorStartsWith;
85
- uriPath = uriPath.replace(/\*$/, '');
86
- }
87
- let ruleStr = '';
88
- if (hostOperator === RuleMatchOperatorEq) {
89
- if (uriPathOperator === RuleMatchOperatorEq) ruleStr = `(${RuleMatchTypeHost} ${hostOperator} "${host}" and ${RuleMatchTypeUriPath} ${uriPathOperator} "${uriPath}")`;
90
- else if (uriPathOperator === RuleMatchOperatorStartsWith) ruleStr = `(${RuleMatchTypeHost} ${hostOperator} "${host}" and ${RuleMatchOperatorStartsWith}(${RuleMatchTypeUriPath}, "${uriPath}"))`;
91
- } else if (hostOperator === RuleMatchOperatorEndsWith) {
92
- if (uriPathOperator === RuleMatchOperatorEq) ruleStr = `(${RuleMatchOperatorEndsWith}(${RuleMatchTypeHost}, "${host}") and ${RuleMatchTypeUriPath} ${uriPathOperator} "${uriPath}")`;
93
- else if (uriPathOperator === RuleMatchOperatorStartsWith) ruleStr = `(${RuleMatchOperatorEndsWith}(${RuleMatchTypeHost}, "${host}") and ${RuleMatchOperatorStartsWith}(${RuleMatchTypeUriPath}, "${uriPath}"))`;
94
- }
95
- return ruleStr;
96
- };
97
32
  function _define_property(obj, key, value) {
98
33
  if (key in obj) Object.defineProperty(obj, key, {
99
34
  value: value,
@@ -117,7 +52,6 @@ class Client {
117
52
  }
118
53
  createRoutine(params) {
119
54
  const request = new esa20240910_namespaceObject.CreateRoutineRequest(params);
120
- log('Creating routine with parameters:', JSON.stringify(params));
121
55
  return this.callApi(this.client.createRoutine.bind(this.client), request);
122
56
  }
123
57
  deleteRoutine(params) {
@@ -275,6 +209,71 @@ class Client {
275
209
  }
276
210
  }
277
211
  const service = new Client();
212
+ const external_form_data_namespaceObject = require("form-data");
213
+ var external_form_data_default = /*#__PURE__*/ __webpack_require__.n(external_form_data_namespaceObject);
214
+ const external_node_fetch_namespaceObject = require("node-fetch");
215
+ var external_node_fetch_default = /*#__PURE__*/ __webpack_require__.n(external_node_fetch_namespaceObject);
216
+ function log(...args) {
217
+ const msg = `[DEBUG ${new Date().toISOString()}] ${args.join(' ')}\n`;
218
+ process.stderr.write(msg);
219
+ }
220
+ const uploadCodeToOSS = async (res, code)=>{
221
+ var _res_body;
222
+ const ossConfig = null == res ? void 0 : null === (_res_body = res.body) || void 0 === _res_body ? void 0 : _res_body.ossPostConfig;
223
+ if (200 !== res.statusCode || !ossConfig) return false;
224
+ const { OSSAccessKeyId, Signature, callback, Url, key, policy } = ossConfig;
225
+ const formData = new (external_form_data_default())();
226
+ formData.append('OSSAccessKeyId', OSSAccessKeyId);
227
+ formData.append('Signature', Signature);
228
+ formData.append('callback', callback);
229
+ formData.append("x:codeDescription", ossConfig["x:codeDescription"]);
230
+ formData.append('policy', policy);
231
+ formData.append('key', key);
232
+ formData.append('file', code);
233
+ const ossRes = await external_node_fetch_default()(Url, {
234
+ method: 'POST',
235
+ body: formData,
236
+ headers: formData.getHeaders()
237
+ });
238
+ return ossRes && 200 === ossRes.status;
239
+ };
240
+ const RuleMatchTypeHost = 'http.host';
241
+ const RuleMatchTypeUriPath = 'http.request.uri.path';
242
+ const RuleMatchOperatorEq = "eq";
243
+ const RuleMatchOperatorStartsWith = "starts_with";
244
+ const RuleMatchOperatorEndsWith = "ends_with";
245
+ const transferRouteToRuleString = (routePath)=>{
246
+ if (!routePath) return '';
247
+ const index = routePath.indexOf('/');
248
+ let host = '';
249
+ let uriPath = '';
250
+ if (index < 0) {
251
+ host = routePath;
252
+ uriPath = '/';
253
+ } else {
254
+ host = routePath.substring(0, index);
255
+ uriPath = routePath.substring(index);
256
+ }
257
+ let hostOperator = RuleMatchOperatorEq;
258
+ if (host.startsWith('*')) {
259
+ hostOperator = RuleMatchOperatorEndsWith;
260
+ host = host.replace(/\*/g, '');
261
+ }
262
+ let uriPathOperator = RuleMatchOperatorEq;
263
+ if (uriPath.endsWith('*')) {
264
+ uriPathOperator = RuleMatchOperatorStartsWith;
265
+ uriPath = uriPath.replace(/\*$/, '');
266
+ }
267
+ let ruleStr = '';
268
+ if (hostOperator === RuleMatchOperatorEq) {
269
+ if (uriPathOperator === RuleMatchOperatorEq) ruleStr = `(${RuleMatchTypeHost} ${hostOperator} "${host}" and ${RuleMatchTypeUriPath} ${uriPathOperator} "${uriPath}")`;
270
+ else if (uriPathOperator === RuleMatchOperatorStartsWith) ruleStr = `(${RuleMatchTypeHost} ${hostOperator} "${host}" and ${RuleMatchOperatorStartsWith}(${RuleMatchTypeUriPath}, "${uriPath}"))`;
271
+ } else if (hostOperator === RuleMatchOperatorEndsWith) {
272
+ if (uriPathOperator === RuleMatchOperatorEq) ruleStr = `(${RuleMatchOperatorEndsWith}(${RuleMatchTypeHost}, "${host}") and ${RuleMatchTypeUriPath} ${uriPathOperator} "${uriPath}")`;
273
+ else if (uriPathOperator === RuleMatchOperatorStartsWith) ruleStr = `(${RuleMatchOperatorEndsWith}(${RuleMatchTypeHost}, "${host}") and ${RuleMatchOperatorStartsWith}(${RuleMatchTypeUriPath}, "${uriPath}"))`;
274
+ }
275
+ return ruleStr;
276
+ };
278
277
  const ROUTINE_CODE_COMMIT_TOOL = {
279
278
  name: 'routine_code_commit',
280
279
  description: 'Save a code version for future modifications or release within an Edge Routine (ER).',
@@ -363,14 +362,6 @@ const ROUTINE_CODE_DEPLOY_TOOL = {
363
362
  env: {
364
363
  type: 'string',
365
364
  description: 'Environment of the routine, must be "production" or "staging". If the user has no special requirements, it will be deployed to the production environment by default'
366
- },
367
- canaryAreaList: {
368
- type: 'array',
369
- description: 'The regions for canary release, must be a valid region name. Need to call ListRoutineCanaryAreas method to get'
370
- },
371
- canaryCodeVersion: {
372
- type: 'string',
373
- description: 'Version of the routine, must be a valid semantic version'
374
365
  }
375
366
  },
376
367
  required: [
@@ -914,6 +905,31 @@ const site_route_list = async (request)=>{
914
905
  success: true
915
906
  };
916
907
  };
908
+ const HTML_DEPLOY_TOOL = {
909
+ name: 'html_deploy',
910
+ description: 'Quickly deploy an HTML page to ESA Edge Routine (ER) and return a default access URL to the user.',
911
+ inputSchema: {
912
+ type: 'object',
913
+ properties: {
914
+ name: {
915
+ type: 'string',
916
+ description: 'The name of the routine, supports lowercase English letters, numbers, and hyphens, must start with a lowercase letter, and must be at least 2 characters long. For example: hello-world'
917
+ },
918
+ html: {
919
+ type: 'string',
920
+ description: 'An HTML string which user want to deploy. For example: <html><body>Hello World</body></html>'
921
+ }
922
+ },
923
+ required: [
924
+ 'name',
925
+ 'html'
926
+ ]
927
+ },
928
+ annotations: {
929
+ readOnlyHint: false,
930
+ idempotentHint: false
931
+ }
932
+ };
917
933
  const ROUTINE_CREATE_TOOL = {
918
934
  name: 'routine_create',
919
935
  description: 'Create a new Edge Routine (ER) in your Alibaba Cloud account.',
@@ -979,6 +995,108 @@ const ROUTINE_GET_TOOL = {
979
995
  ]
980
996
  }
981
997
  };
998
+ const html_deploy = async (request)=>{
999
+ var _request_params_arguments, _request_params, _request_params_arguments1, _request_params1, _createRoutineRes_body;
1000
+ const html = (null == request ? void 0 : null === (_request_params = request.params) || void 0 === _request_params ? void 0 : null === (_request_params_arguments = _request_params.arguments) || void 0 === _request_params_arguments ? void 0 : _request_params_arguments.html).replace(/`/g, '\\`').replace(/\$/g, '\\$');
1001
+ const code = `const html = \`${html}\`;
1002
+
1003
+ async function handleRequest(request) {
1004
+ return new Response(html, {
1005
+ headers: {
1006
+ "content-type": "text/html;charset=UTF-8",
1007
+ },
1008
+ });
1009
+ }
1010
+
1011
+ export default {
1012
+ async fetch(request) {
1013
+ return handleRequest(request);
1014
+ },
1015
+ };
1016
+ `;
1017
+ const createRoutineRes = await service.createRoutine({
1018
+ name: (null == request ? void 0 : null === (_request_params1 = request.params) || void 0 === _request_params1 ? void 0 : null === (_request_params_arguments1 = _request_params1.arguments) || void 0 === _request_params_arguments1 ? void 0 : _request_params_arguments1.name) || '',
1019
+ code: code
1020
+ });
1021
+ if (200 !== createRoutineRes.statusCode || (null === (_createRoutineRes_body = createRoutineRes.body) || void 0 === _createRoutineRes_body ? void 0 : _createRoutineRes_body.status) !== 'OK') return {
1022
+ content: [
1023
+ {
1024
+ type: 'text',
1025
+ text: `Failed to create routine. ${JSON.stringify(createRoutineRes)}`
1026
+ }
1027
+ ],
1028
+ success: false
1029
+ };
1030
+ {
1031
+ var _getOssInfoRes_body_ossPostConfig, _getOssInfoRes_body;
1032
+ const getOssInfoRes = await service.getRoutineStagingCodeUploadInfo(request.params.arguments);
1033
+ if (!getOssInfoRes || (null == getOssInfoRes ? void 0 : getOssInfoRes.statusCode) !== 200 || !(null == getOssInfoRes ? void 0 : null === (_getOssInfoRes_body = getOssInfoRes.body) || void 0 === _getOssInfoRes_body ? void 0 : null === (_getOssInfoRes_body_ossPostConfig = _getOssInfoRes_body.ossPostConfig) || void 0 === _getOssInfoRes_body_ossPostConfig ? void 0 : _getOssInfoRes_body_ossPostConfig.OSSAccessKeyId)) return {
1034
+ content: [
1035
+ {
1036
+ type: 'text',
1037
+ text: `Failed to get routine staging code upload info. ${JSON.stringify(getOssInfoRes)}`
1038
+ }
1039
+ ],
1040
+ success: false
1041
+ };
1042
+ {
1043
+ const uploadRes = await uploadCodeToOSS(getOssInfoRes, code);
1044
+ if (true !== uploadRes) return {
1045
+ content: [
1046
+ {
1047
+ type: 'text',
1048
+ text: `Failed to upload code to OSS. ${uploadRes}`
1049
+ }
1050
+ ],
1051
+ success: false
1052
+ };
1053
+ {
1054
+ const commitRes = await service.commitRoutineStagingCode(request.params.arguments);
1055
+ if (200 !== commitRes.statusCode) return {
1056
+ content: [
1057
+ {
1058
+ type: 'text',
1059
+ text: `Failed to commit routine staging code. ${JSON.stringify(commitRes)}`
1060
+ }
1061
+ ],
1062
+ success: false
1063
+ };
1064
+ {
1065
+ var _request_params_arguments2, _request_params2, _commitRes_body;
1066
+ const deployRes = await service.publishRoutineCodeVersion({
1067
+ name: (null == request ? void 0 : null === (_request_params2 = request.params) || void 0 === _request_params2 ? void 0 : null === (_request_params_arguments2 = _request_params2.arguments) || void 0 === _request_params_arguments2 ? void 0 : _request_params_arguments2.name) || '',
1068
+ env: 'production',
1069
+ codeVersion: null == commitRes ? void 0 : null === (_commitRes_body = commitRes.body) || void 0 === _commitRes_body ? void 0 : _commitRes_body.codeVersion
1070
+ });
1071
+ if (200 !== deployRes.statusCode) return {
1072
+ content: [
1073
+ {
1074
+ type: 'text',
1075
+ text: `Failed to get routine. ${JSON.stringify(deployRes)}`
1076
+ }
1077
+ ],
1078
+ success: false
1079
+ };
1080
+ {
1081
+ var _request_params_arguments3, _request_params3;
1082
+ const res = await service.getRoutine({
1083
+ name: (null == request ? void 0 : null === (_request_params3 = request.params) || void 0 === _request_params3 ? void 0 : null === (_request_params_arguments3 = _request_params3.arguments) || void 0 === _request_params_arguments3 ? void 0 : _request_params_arguments3.name) || ''
1084
+ });
1085
+ return {
1086
+ content: [
1087
+ {
1088
+ type: 'text',
1089
+ text: JSON.stringify(res)
1090
+ }
1091
+ ],
1092
+ success: true
1093
+ };
1094
+ }
1095
+ }
1096
+ }
1097
+ }
1098
+ }
1099
+ };
982
1100
  const routine_create = async (request)=>{
983
1101
  const res = await service.createRoutine(request.params.arguments);
984
1102
  return {
@@ -1234,6 +1352,7 @@ const site_match = async (request)=>{
1234
1352
  };
1235
1353
  };
1236
1354
  const ESA_OPENAPI_ER_LIST = [
1355
+ HTML_DEPLOY_TOOL,
1237
1356
  ROUTINE_CREATE_TOOL,
1238
1357
  ROUTINE_DELETE_TOOL,
1239
1358
  ROUTINE_LIST_TOOL,
@@ -1260,7 +1379,7 @@ const ESA_OPENAPI_ER_LIST = [
1260
1379
  const ESA_OPENAPI_LIST = [
1261
1380
  ...ESA_OPENAPI_ER_LIST
1262
1381
  ];
1263
- const routineHandlers = {
1382
+ const esaHandlers = {
1264
1383
  site_dns_a_record_create: site_dns_a_record_create,
1265
1384
  site_dns_cname_record_create: site_dns_cname_record_create,
1266
1385
  site_active_list: site_active_list,
@@ -1282,7 +1401,8 @@ const routineHandlers = {
1282
1401
  route_get: route_get,
1283
1402
  er_record_create: er_record_create,
1284
1403
  er_record_delete: er_record_delete,
1285
- er_record_list: er_record_list
1404
+ er_record_list: er_record_list,
1405
+ html_deploy: html_deploy
1286
1406
  };
1287
1407
  const server = new index_js_namespaceObject.Server({
1288
1408
  name: 'esa-server',
@@ -1298,7 +1418,7 @@ server.setRequestHandler(types_js_namespaceObject.ListToolsRequestSchema, async
1298
1418
  server.setRequestHandler(types_js_namespaceObject.CallToolRequestSchema, async (request)=>{
1299
1419
  const toolName = request.params.name;
1300
1420
  log('Received tool call:', toolName, 'Params:', JSON.stringify(request.params));
1301
- return await routineHandlers[toolName](request);
1421
+ return await esaHandlers[toolName](request);
1302
1422
  });
1303
1423
  async function main() {
1304
1424
  const transport = new stdio_js_namespaceObject.StdioServerTransport();
package/dist/index.mjs CHANGED
@@ -7,67 +7,6 @@ import * as __WEBPACK_EXTERNAL_MODULE__alicloud_openapi_client_042fbc19__ from "
7
7
  import * as __WEBPACK_EXTERNAL_MODULE__alicloud_tea_util_fe2b8eb4__ from "@alicloud/tea-util";
8
8
  import * as __WEBPACK_EXTERNAL_MODULE_form_data_cf000082__ from "form-data";
9
9
  import * as __WEBPACK_EXTERNAL_MODULE_node_fetch_7c57b483__ from "node-fetch";
10
- function log(...args) {
11
- const msg = `[DEBUG ${new Date().toISOString()}] ${args.join(' ')}\n`;
12
- process.stderr.write(msg);
13
- }
14
- const uploadCodeToOSS = async (res, code)=>{
15
- var _res_body;
16
- const ossConfig = null == res ? void 0 : null === (_res_body = res.body) || void 0 === _res_body ? void 0 : _res_body.ossPostConfig;
17
- if (200 !== res.statusCode || !ossConfig) return false;
18
- const { OSSAccessKeyId, Signature, callback, Url, key, policy } = ossConfig;
19
- const formData = new __WEBPACK_EXTERNAL_MODULE_form_data_cf000082__["default"]();
20
- formData.append('OSSAccessKeyId', OSSAccessKeyId);
21
- formData.append('Signature', Signature);
22
- formData.append('callback', callback);
23
- formData.append("x:codeDescription", ossConfig["x:codeDescription"]);
24
- formData.append('policy', policy);
25
- formData.append('key', key);
26
- formData.append('file', code);
27
- const ossRes = await (0, __WEBPACK_EXTERNAL_MODULE_node_fetch_7c57b483__["default"])(Url, {
28
- method: 'POST',
29
- body: formData,
30
- headers: formData.getHeaders()
31
- });
32
- return ossRes && 200 === ossRes.status;
33
- };
34
- const RuleMatchTypeHost = 'http.host';
35
- const RuleMatchTypeUriPath = 'http.request.uri.path';
36
- const RuleMatchOperatorEq = "eq";
37
- const RuleMatchOperatorStartsWith = "starts_with";
38
- const RuleMatchOperatorEndsWith = "ends_with";
39
- const transferRouteToRuleString = (routePath)=>{
40
- if (!routePath) return '';
41
- const index = routePath.indexOf('/');
42
- let host = '';
43
- let uriPath = '';
44
- if (index < 0) {
45
- host = routePath;
46
- uriPath = '/';
47
- } else {
48
- host = routePath.substring(0, index);
49
- uriPath = routePath.substring(index);
50
- }
51
- let hostOperator = RuleMatchOperatorEq;
52
- if (host.startsWith('*')) {
53
- hostOperator = RuleMatchOperatorEndsWith;
54
- host = host.replace(/\*/g, '');
55
- }
56
- let uriPathOperator = RuleMatchOperatorEq;
57
- if (uriPath.endsWith('*')) {
58
- uriPathOperator = RuleMatchOperatorStartsWith;
59
- uriPath = uriPath.replace(/\*$/, '');
60
- }
61
- let ruleStr = '';
62
- if (hostOperator === RuleMatchOperatorEq) {
63
- if (uriPathOperator === RuleMatchOperatorEq) ruleStr = `(${RuleMatchTypeHost} ${hostOperator} "${host}" and ${RuleMatchTypeUriPath} ${uriPathOperator} "${uriPath}")`;
64
- else if (uriPathOperator === RuleMatchOperatorStartsWith) ruleStr = `(${RuleMatchTypeHost} ${hostOperator} "${host}" and ${RuleMatchOperatorStartsWith}(${RuleMatchTypeUriPath}, "${uriPath}"))`;
65
- } else if (hostOperator === RuleMatchOperatorEndsWith) {
66
- if (uriPathOperator === RuleMatchOperatorEq) ruleStr = `(${RuleMatchOperatorEndsWith}(${RuleMatchTypeHost}, "${host}") and ${RuleMatchTypeUriPath} ${uriPathOperator} "${uriPath}")`;
67
- else if (uriPathOperator === RuleMatchOperatorStartsWith) ruleStr = `(${RuleMatchOperatorEndsWith}(${RuleMatchTypeHost}, "${host}") and ${RuleMatchOperatorStartsWith}(${RuleMatchTypeUriPath}, "${uriPath}"))`;
68
- }
69
- return ruleStr;
70
- };
71
10
  function _define_property(obj, key, value) {
72
11
  if (key in obj) Object.defineProperty(obj, key, {
73
12
  value: value,
@@ -91,7 +30,6 @@ class Client {
91
30
  }
92
31
  createRoutine(params) {
93
32
  const request = new __WEBPACK_EXTERNAL_MODULE__alicloud_esa20240910_b5517a12__.CreateRoutineRequest(params);
94
- log('Creating routine with parameters:', JSON.stringify(params));
95
33
  return this.callApi(this.client.createRoutine.bind(this.client), request);
96
34
  }
97
35
  deleteRoutine(params) {
@@ -249,6 +187,67 @@ class Client {
249
187
  }
250
188
  }
251
189
  const service = new Client();
190
+ function log(...args) {
191
+ const msg = `[DEBUG ${new Date().toISOString()}] ${args.join(' ')}\n`;
192
+ process.stderr.write(msg);
193
+ }
194
+ const uploadCodeToOSS = async (res, code)=>{
195
+ var _res_body;
196
+ const ossConfig = null == res ? void 0 : null === (_res_body = res.body) || void 0 === _res_body ? void 0 : _res_body.ossPostConfig;
197
+ if (200 !== res.statusCode || !ossConfig) return false;
198
+ const { OSSAccessKeyId, Signature, callback, Url, key, policy } = ossConfig;
199
+ const formData = new __WEBPACK_EXTERNAL_MODULE_form_data_cf000082__["default"]();
200
+ formData.append('OSSAccessKeyId', OSSAccessKeyId);
201
+ formData.append('Signature', Signature);
202
+ formData.append('callback', callback);
203
+ formData.append("x:codeDescription", ossConfig["x:codeDescription"]);
204
+ formData.append('policy', policy);
205
+ formData.append('key', key);
206
+ formData.append('file', code);
207
+ const ossRes = await (0, __WEBPACK_EXTERNAL_MODULE_node_fetch_7c57b483__["default"])(Url, {
208
+ method: 'POST',
209
+ body: formData,
210
+ headers: formData.getHeaders()
211
+ });
212
+ return ossRes && 200 === ossRes.status;
213
+ };
214
+ const RuleMatchTypeHost = 'http.host';
215
+ const RuleMatchTypeUriPath = 'http.request.uri.path';
216
+ const RuleMatchOperatorEq = "eq";
217
+ const RuleMatchOperatorStartsWith = "starts_with";
218
+ const RuleMatchOperatorEndsWith = "ends_with";
219
+ const transferRouteToRuleString = (routePath)=>{
220
+ if (!routePath) return '';
221
+ const index = routePath.indexOf('/');
222
+ let host = '';
223
+ let uriPath = '';
224
+ if (index < 0) {
225
+ host = routePath;
226
+ uriPath = '/';
227
+ } else {
228
+ host = routePath.substring(0, index);
229
+ uriPath = routePath.substring(index);
230
+ }
231
+ let hostOperator = RuleMatchOperatorEq;
232
+ if (host.startsWith('*')) {
233
+ hostOperator = RuleMatchOperatorEndsWith;
234
+ host = host.replace(/\*/g, '');
235
+ }
236
+ let uriPathOperator = RuleMatchOperatorEq;
237
+ if (uriPath.endsWith('*')) {
238
+ uriPathOperator = RuleMatchOperatorStartsWith;
239
+ uriPath = uriPath.replace(/\*$/, '');
240
+ }
241
+ let ruleStr = '';
242
+ if (hostOperator === RuleMatchOperatorEq) {
243
+ if (uriPathOperator === RuleMatchOperatorEq) ruleStr = `(${RuleMatchTypeHost} ${hostOperator} "${host}" and ${RuleMatchTypeUriPath} ${uriPathOperator} "${uriPath}")`;
244
+ else if (uriPathOperator === RuleMatchOperatorStartsWith) ruleStr = `(${RuleMatchTypeHost} ${hostOperator} "${host}" and ${RuleMatchOperatorStartsWith}(${RuleMatchTypeUriPath}, "${uriPath}"))`;
245
+ } else if (hostOperator === RuleMatchOperatorEndsWith) {
246
+ if (uriPathOperator === RuleMatchOperatorEq) ruleStr = `(${RuleMatchOperatorEndsWith}(${RuleMatchTypeHost}, "${host}") and ${RuleMatchTypeUriPath} ${uriPathOperator} "${uriPath}")`;
247
+ else if (uriPathOperator === RuleMatchOperatorStartsWith) ruleStr = `(${RuleMatchOperatorEndsWith}(${RuleMatchTypeHost}, "${host}") and ${RuleMatchOperatorStartsWith}(${RuleMatchTypeUriPath}, "${uriPath}"))`;
248
+ }
249
+ return ruleStr;
250
+ };
252
251
  const ROUTINE_CODE_COMMIT_TOOL = {
253
252
  name: 'routine_code_commit',
254
253
  description: 'Save a code version for future modifications or release within an Edge Routine (ER).',
@@ -337,14 +336,6 @@ const ROUTINE_CODE_DEPLOY_TOOL = {
337
336
  env: {
338
337
  type: 'string',
339
338
  description: 'Environment of the routine, must be "production" or "staging". If the user has no special requirements, it will be deployed to the production environment by default'
340
- },
341
- canaryAreaList: {
342
- type: 'array',
343
- description: 'The regions for canary release, must be a valid region name. Need to call ListRoutineCanaryAreas method to get'
344
- },
345
- canaryCodeVersion: {
346
- type: 'string',
347
- description: 'Version of the routine, must be a valid semantic version'
348
339
  }
349
340
  },
350
341
  required: [
@@ -888,6 +879,31 @@ const site_route_list = async (request)=>{
888
879
  success: true
889
880
  };
890
881
  };
882
+ const HTML_DEPLOY_TOOL = {
883
+ name: 'html_deploy',
884
+ description: 'Quickly deploy an HTML page to ESA Edge Routine (ER) and return a default access URL to the user.',
885
+ inputSchema: {
886
+ type: 'object',
887
+ properties: {
888
+ name: {
889
+ type: 'string',
890
+ description: 'The name of the routine, supports lowercase English letters, numbers, and hyphens, must start with a lowercase letter, and must be at least 2 characters long. For example: hello-world'
891
+ },
892
+ html: {
893
+ type: 'string',
894
+ description: 'An HTML string which user want to deploy. For example: <html><body>Hello World</body></html>'
895
+ }
896
+ },
897
+ required: [
898
+ 'name',
899
+ 'html'
900
+ ]
901
+ },
902
+ annotations: {
903
+ readOnlyHint: false,
904
+ idempotentHint: false
905
+ }
906
+ };
891
907
  const ROUTINE_CREATE_TOOL = {
892
908
  name: 'routine_create',
893
909
  description: 'Create a new Edge Routine (ER) in your Alibaba Cloud account.',
@@ -953,6 +969,108 @@ const ROUTINE_GET_TOOL = {
953
969
  ]
954
970
  }
955
971
  };
972
+ const html_deploy = async (request)=>{
973
+ var _request_params_arguments, _request_params, _request_params_arguments1, _request_params1, _createRoutineRes_body;
974
+ const html = (null == request ? void 0 : null === (_request_params = request.params) || void 0 === _request_params ? void 0 : null === (_request_params_arguments = _request_params.arguments) || void 0 === _request_params_arguments ? void 0 : _request_params_arguments.html).replace(/`/g, '\\`').replace(/\$/g, '\\$');
975
+ const code = `const html = \`${html}\`;
976
+
977
+ async function handleRequest(request) {
978
+ return new Response(html, {
979
+ headers: {
980
+ "content-type": "text/html;charset=UTF-8",
981
+ },
982
+ });
983
+ }
984
+
985
+ export default {
986
+ async fetch(request) {
987
+ return handleRequest(request);
988
+ },
989
+ };
990
+ `;
991
+ const createRoutineRes = await service.createRoutine({
992
+ name: (null == request ? void 0 : null === (_request_params1 = request.params) || void 0 === _request_params1 ? void 0 : null === (_request_params_arguments1 = _request_params1.arguments) || void 0 === _request_params_arguments1 ? void 0 : _request_params_arguments1.name) || '',
993
+ code: code
994
+ });
995
+ if (200 !== createRoutineRes.statusCode || (null === (_createRoutineRes_body = createRoutineRes.body) || void 0 === _createRoutineRes_body ? void 0 : _createRoutineRes_body.status) !== 'OK') return {
996
+ content: [
997
+ {
998
+ type: 'text',
999
+ text: `Failed to create routine. ${JSON.stringify(createRoutineRes)}`
1000
+ }
1001
+ ],
1002
+ success: false
1003
+ };
1004
+ {
1005
+ var _getOssInfoRes_body_ossPostConfig, _getOssInfoRes_body;
1006
+ const getOssInfoRes = await service.getRoutineStagingCodeUploadInfo(request.params.arguments);
1007
+ if (!getOssInfoRes || (null == getOssInfoRes ? void 0 : getOssInfoRes.statusCode) !== 200 || !(null == getOssInfoRes ? void 0 : null === (_getOssInfoRes_body = getOssInfoRes.body) || void 0 === _getOssInfoRes_body ? void 0 : null === (_getOssInfoRes_body_ossPostConfig = _getOssInfoRes_body.ossPostConfig) || void 0 === _getOssInfoRes_body_ossPostConfig ? void 0 : _getOssInfoRes_body_ossPostConfig.OSSAccessKeyId)) return {
1008
+ content: [
1009
+ {
1010
+ type: 'text',
1011
+ text: `Failed to get routine staging code upload info. ${JSON.stringify(getOssInfoRes)}`
1012
+ }
1013
+ ],
1014
+ success: false
1015
+ };
1016
+ {
1017
+ const uploadRes = await uploadCodeToOSS(getOssInfoRes, code);
1018
+ if (true !== uploadRes) return {
1019
+ content: [
1020
+ {
1021
+ type: 'text',
1022
+ text: `Failed to upload code to OSS. ${uploadRes}`
1023
+ }
1024
+ ],
1025
+ success: false
1026
+ };
1027
+ {
1028
+ const commitRes = await service.commitRoutineStagingCode(request.params.arguments);
1029
+ if (200 !== commitRes.statusCode) return {
1030
+ content: [
1031
+ {
1032
+ type: 'text',
1033
+ text: `Failed to commit routine staging code. ${JSON.stringify(commitRes)}`
1034
+ }
1035
+ ],
1036
+ success: false
1037
+ };
1038
+ {
1039
+ var _request_params_arguments2, _request_params2, _commitRes_body;
1040
+ const deployRes = await service.publishRoutineCodeVersion({
1041
+ name: (null == request ? void 0 : null === (_request_params2 = request.params) || void 0 === _request_params2 ? void 0 : null === (_request_params_arguments2 = _request_params2.arguments) || void 0 === _request_params_arguments2 ? void 0 : _request_params_arguments2.name) || '',
1042
+ env: 'production',
1043
+ codeVersion: null == commitRes ? void 0 : null === (_commitRes_body = commitRes.body) || void 0 === _commitRes_body ? void 0 : _commitRes_body.codeVersion
1044
+ });
1045
+ if (200 !== deployRes.statusCode) return {
1046
+ content: [
1047
+ {
1048
+ type: 'text',
1049
+ text: `Failed to get routine. ${JSON.stringify(deployRes)}`
1050
+ }
1051
+ ],
1052
+ success: false
1053
+ };
1054
+ {
1055
+ var _request_params_arguments3, _request_params3;
1056
+ const res = await service.getRoutine({
1057
+ name: (null == request ? void 0 : null === (_request_params3 = request.params) || void 0 === _request_params3 ? void 0 : null === (_request_params_arguments3 = _request_params3.arguments) || void 0 === _request_params_arguments3 ? void 0 : _request_params_arguments3.name) || ''
1058
+ });
1059
+ return {
1060
+ content: [
1061
+ {
1062
+ type: 'text',
1063
+ text: JSON.stringify(res)
1064
+ }
1065
+ ],
1066
+ success: true
1067
+ };
1068
+ }
1069
+ }
1070
+ }
1071
+ }
1072
+ }
1073
+ };
956
1074
  const routine_create = async (request)=>{
957
1075
  const res = await service.createRoutine(request.params.arguments);
958
1076
  return {
@@ -1208,6 +1326,7 @@ const site_match = async (request)=>{
1208
1326
  };
1209
1327
  };
1210
1328
  const ESA_OPENAPI_ER_LIST = [
1329
+ HTML_DEPLOY_TOOL,
1211
1330
  ROUTINE_CREATE_TOOL,
1212
1331
  ROUTINE_DELETE_TOOL,
1213
1332
  ROUTINE_LIST_TOOL,
@@ -1234,7 +1353,7 @@ const ESA_OPENAPI_ER_LIST = [
1234
1353
  const ESA_OPENAPI_LIST = [
1235
1354
  ...ESA_OPENAPI_ER_LIST
1236
1355
  ];
1237
- const routineHandlers = {
1356
+ const esaHandlers = {
1238
1357
  site_dns_a_record_create: site_dns_a_record_create,
1239
1358
  site_dns_cname_record_create: site_dns_cname_record_create,
1240
1359
  site_active_list: site_active_list,
@@ -1256,7 +1375,8 @@ const routineHandlers = {
1256
1375
  route_get: route_get,
1257
1376
  er_record_create: er_record_create,
1258
1377
  er_record_delete: er_record_delete,
1259
- er_record_list: er_record_list
1378
+ er_record_list: er_record_list,
1379
+ html_deploy: html_deploy
1260
1380
  };
1261
1381
  const server = new __WEBPACK_EXTERNAL_MODULE__modelcontextprotocol_sdk_server_index_js_269b79bf__.Server({
1262
1382
  name: 'esa-server',
@@ -1272,7 +1392,7 @@ server.setRequestHandler(__WEBPACK_EXTERNAL_MODULE__modelcontextprotocol_sdk_typ
1272
1392
  server.setRequestHandler(__WEBPACK_EXTERNAL_MODULE__modelcontextprotocol_sdk_types_js_fc45a208__.CallToolRequestSchema, async (request)=>{
1273
1393
  const toolName = request.params.name;
1274
1394
  log('Received tool call:', toolName, 'Params:', JSON.stringify(request.params));
1275
- return await routineHandlers[toolName](request);
1395
+ return await esaHandlers[toolName](request);
1276
1396
  });
1277
1397
  async function main() {
1278
1398
  const transport = new __WEBPACK_EXTERNAL_MODULE__modelcontextprotocol_sdk_server_stdio_js_4f861174__.StdioServerTransport();
@@ -39,4 +39,4 @@ export declare const ESA_OPENAPI_LIST: {
39
39
  openWorldHint?: boolean | undefined;
40
40
  } | undefined;
41
41
  }[];
42
- export declare const routineHandlers: ToolHandlers;
42
+ export declare const esaHandlers: ToolHandlers;
@@ -1,8 +1,16 @@
1
1
  import { CallToolRequest, Tool } from '@modelcontextprotocol/sdk/types.js';
2
+ export declare const HTML_DEPLOY_TOOL: Tool;
2
3
  export declare const ROUTINE_CREATE_TOOL: Tool;
3
4
  export declare const ROUTINE_DELETE_TOOL: Tool;
4
5
  export declare const ROUTINE_LIST_TOOL: Tool;
5
6
  export declare const ROUTINE_GET_TOOL: Tool;
7
+ export declare const html_deploy: (request: CallToolRequest) => Promise<{
8
+ content: {
9
+ type: string;
10
+ text: string;
11
+ }[];
12
+ success: boolean;
13
+ }>;
6
14
  export declare const routine_create: (request: CallToolRequest) => Promise<{
7
15
  content: {
8
16
  type: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-server-esa",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "Alibaba Cloud ESA (Edge Security Acceleration) MCP Server",
5
5
  "main": "./dist/index.js",
6
6
  "type": "commonjs",
package/readme.md CHANGED
@@ -60,6 +60,7 @@ https://esa.console.aliyun.com/edge/function/list
60
60
 
61
61
  | Category | Tool | Description |
62
62
  | --------------- | ---------------------------- | ------------------------------------------------------------------------------------ |
63
+ | **HTML** | html_deploy | Quick deploy a HTML in a new Edge Routine (ER) |
63
64
  | **Routines** | routine_create | Create a new Edge Routine (ER) in your Alibaba Cloud account. |
64
65
  | | routine_delete | Delete an existing Edge Routine (ER) from your Alibaba Cloud account. |
65
66
  | | routine_list | List all Edge Routines (ERs) in your Alibaba Cloud account. |
package/readme_zh.md CHANGED
@@ -60,6 +60,7 @@
60
60
 
61
61
  | 类别 | 工具 | 描述 |
62
62
  | ------------ | ---------------------------- | ------------------------------------------------------ |
63
+ | **HTML** | html_deploy | 快速部署一个HTML到新的边缘函数(ER) |
63
64
  | **边缘函数** | routine_create | 在你的阿里云账户中创建新的边缘函数(ER)。 |
64
65
  | | routine_delete | 从你的阿里云账户中删除现有的边缘函数(ER)。 |
65
66
  | | routine_list | 列出你的阿里云账户中的所有边缘函数(ER)。 |
@@ -90,6 +91,7 @@
90
91
  - 我的边缘函数“hello-world”的默认访问地址是什么?
91
92
  - 为 `test.example.com` 创建一个 CNAME 记录,值设置为 `example2.com`。
92
93
  - 为 `test.example.com` 创建一个 A 记录,值设置为 `1.1.1.1`。
94
+ - 编写一个五子棋HTML到ER中
93
95
 
94
96
  ## 许可证
95
97
 
package/src/index.ts CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  CallToolRequestSchema,
7
7
  ListToolsRequestSchema,
8
8
  } from '@modelcontextprotocol/sdk/types.js';
9
- import { ESA_OPENAPI_LIST, routineHandlers } from './tools/list-esa-function';
9
+ import { ESA_OPENAPI_LIST, esaHandlers } from './tools/list-esa-function';
10
10
  import { log } from './utils/helpers';
11
11
 
12
12
  const server = new Server(
@@ -35,7 +35,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
35
35
  'Params:',
36
36
  JSON.stringify(request.params),
37
37
  );
38
- return await routineHandlers[toolName](request);
38
+ return await esaHandlers[toolName](request);
39
39
  });
40
40
 
41
41
  async function main() {
@@ -26,15 +26,6 @@ export const ROUTINE_CODE_DEPLOY_TOOL: Tool = {
26
26
  description:
27
27
  'Environment of the routine, must be "production" or "staging". If the user has no special requirements, it will be deployed to the production environment by default',
28
28
  },
29
- canaryAreaList: {
30
- type: 'array',
31
- description:
32
- 'The regions for canary release, must be a valid region name. Need to call ListRoutineCanaryAreas method to get',
33
- },
34
- canaryCodeVersion: {
35
- type: 'string',
36
- description: 'Version of the routine, must be a valid semantic version',
37
- },
38
29
  },
39
30
  required: ['name', 'codeVersion', 'env'],
40
31
  },
@@ -38,6 +38,8 @@ import {
38
38
  routine_create,
39
39
  routine_list,
40
40
  routine_get,
41
+ HTML_DEPLOY_TOOL,
42
+ html_deploy,
41
43
  } from './routine';
42
44
  import {
43
45
  site_active_list,
@@ -53,6 +55,7 @@ import {
53
55
  } from './site';
54
56
 
55
57
  export const ESA_OPENAPI_ER_LIST = [
58
+ HTML_DEPLOY_TOOL,
56
59
  ROUTINE_CREATE_TOOL,
57
60
  ROUTINE_DELETE_TOOL,
58
61
  ROUTINE_LIST_TOOL,
@@ -78,7 +81,7 @@ export const ESA_OPENAPI_ER_LIST = [
78
81
  ];
79
82
 
80
83
  export const ESA_OPENAPI_LIST = [...ESA_OPENAPI_ER_LIST];
81
- export const routineHandlers: ToolHandlers = {
84
+ export const esaHandlers: ToolHandlers = {
82
85
  site_dns_a_record_create,
83
86
  site_dns_cname_record_create,
84
87
  site_active_list,
@@ -101,4 +104,5 @@ export const routineHandlers: ToolHandlers = {
101
104
  er_record_create,
102
105
  er_record_delete,
103
106
  er_record_list,
107
+ html_deploy,
104
108
  };
@@ -1,11 +1,43 @@
1
1
  import { CallToolRequest, Tool } from '@modelcontextprotocol/sdk/types.js';
2
2
  import api from '../utils/service.js';
3
3
  import {
4
+ CommitRoutineStagingCodeRequest,
4
5
  CreateRoutineRequest,
5
6
  DeleteRoutineRequest,
6
7
  GetRoutineRequest,
8
+ GetRoutineStagingCodeUploadInfoRequest,
9
+ PublishRoutineCodeVersionRequest,
7
10
  } from '@alicloud/esa20240910';
11
+ import { uploadCodeToOSS } from '../utils/helpers.js';
8
12
 
13
+ // Prompt:帮我写个HTML部署在ER上
14
+ export const HTML_DEPLOY_TOOL: Tool = {
15
+ name: 'html_deploy',
16
+ description:
17
+ 'Quickly deploy an HTML page to ESA Edge Routine (ER) and return a default access URL to the user.',
18
+ inputSchema: {
19
+ type: 'object',
20
+ properties: {
21
+ name: {
22
+ type: 'string',
23
+ description:
24
+ 'The name of the routine, supports lowercase English letters, numbers, and hyphens, must start with a lowercase letter, and must be at least 2 characters long. For example: hello-world',
25
+ },
26
+ html: {
27
+ type: 'string',
28
+ description:
29
+ 'An HTML string which user want to deploy. For example: <html><body>Hello World</body></html>',
30
+ },
31
+ },
32
+ required: ['name', 'html'],
33
+ },
34
+ annotations: {
35
+ readOnlyHint: false,
36
+ idempotentHint: false,
37
+ },
38
+ };
39
+
40
+ // Prompt: 帮我创建一个er名称是test-kl-2 描述是test 代码是helloworld
9
41
  export const ROUTINE_CREATE_TOOL: Tool = {
10
42
  name: 'routine_create',
11
43
  description: 'Create a new Edge Routine (ER) in your Alibaba Cloud account.',
@@ -71,6 +103,127 @@ export const ROUTINE_GET_TOOL: Tool = {
71
103
  },
72
104
  };
73
105
 
106
+ export const html_deploy = async (request: CallToolRequest) => {
107
+ // Escape backticks and dollar signs in the HTML string
108
+ const html = (request?.params?.arguments?.html as string)
109
+ .replace(/`/g, '\\`')
110
+ .replace(/\$/g, '\\$');
111
+
112
+ const code = `const html = \`${html}\`;
113
+
114
+ async function handleRequest(request) {
115
+ return new Response(html, {
116
+ headers: {
117
+ "content-type": "text/html;charset=UTF-8",
118
+ },
119
+ });
120
+ }
121
+
122
+ export default {
123
+ async fetch(request) {
124
+ return handleRequest(request);
125
+ },
126
+ };
127
+ `;
128
+
129
+ const createRoutineRes = await api.createRoutine({
130
+ name: request?.params?.arguments?.name || '',
131
+ code: code,
132
+ } as unknown as CreateRoutineRequest);
133
+ // Create Edge Routine
134
+ if (
135
+ createRoutineRes.statusCode === 200 &&
136
+ createRoutineRes.body?.status === 'OK'
137
+ ) {
138
+ const getOssInfoRes = await api.getRoutineStagingCodeUploadInfo(
139
+ request.params.arguments as GetRoutineStagingCodeUploadInfoRequest,
140
+ );
141
+ if (
142
+ !getOssInfoRes ||
143
+ getOssInfoRes?.statusCode !== 200 ||
144
+ !getOssInfoRes?.body?.ossPostConfig?.OSSAccessKeyId
145
+ ) {
146
+ return {
147
+ content: [
148
+ {
149
+ type: 'text',
150
+ text: `Failed to get routine staging code upload info. ${JSON.stringify(getOssInfoRes)}`,
151
+ },
152
+ ],
153
+ success: false,
154
+ };
155
+ } else {
156
+ const uploadRes = await uploadCodeToOSS(getOssInfoRes, code as string);
157
+ if (uploadRes !== true) {
158
+ return {
159
+ content: [
160
+ {
161
+ type: 'text',
162
+ text: `Failed to upload code to OSS. ${uploadRes}`,
163
+ },
164
+ ],
165
+ success: false,
166
+ };
167
+ } else {
168
+ const commitRes = await api.commitRoutineStagingCode(
169
+ request.params.arguments as CommitRoutineStagingCodeRequest,
170
+ );
171
+ if (commitRes.statusCode !== 200) {
172
+ return {
173
+ content: [
174
+ {
175
+ type: 'text',
176
+ text: `Failed to commit routine staging code. ${JSON.stringify(commitRes)}`,
177
+ },
178
+ ],
179
+ success: false,
180
+ };
181
+ } else {
182
+ const deployRes = await api.publishRoutineCodeVersion({
183
+ name: request?.params?.arguments?.name || '',
184
+ env: 'production',
185
+ codeVersion: commitRes?.body?.codeVersion,
186
+ } as PublishRoutineCodeVersionRequest);
187
+ if (deployRes.statusCode === 200) {
188
+ const res = await api.getRoutine({
189
+ name: request?.params?.arguments?.name || '',
190
+ } as GetRoutineRequest);
191
+ return {
192
+ content: [
193
+ {
194
+ type: 'text',
195
+ text: JSON.stringify(res),
196
+ },
197
+ ],
198
+ success: true,
199
+ };
200
+ } else {
201
+ return {
202
+ content: [
203
+ {
204
+ type: 'text',
205
+ text: `Failed to get routine. ${JSON.stringify(deployRes)}`,
206
+ },
207
+ ],
208
+ success: false,
209
+ };
210
+ }
211
+ }
212
+ }
213
+ }
214
+ } else {
215
+ return {
216
+ content: [
217
+ {
218
+ type: 'text',
219
+ text: `Failed to create routine. ${JSON.stringify(createRoutineRes)}`,
220
+ },
221
+ ],
222
+ success: false,
223
+ };
224
+ }
225
+ };
226
+
74
227
  export const routine_create = async (request: CallToolRequest) => {
75
228
  const res = await api.createRoutine(
76
229
  request.params.arguments as CreateRoutineRequest,
@@ -38,7 +38,6 @@ import ESA, {
38
38
  } from '@alicloud/esa20240910';
39
39
  import * as $OpenApi from '@alicloud/openapi-client';
40
40
  import * as $Util from '@alicloud/tea-util';
41
- import { log } from './helpers';
42
41
  import {
43
42
  CliConfig,
44
43
  GetMatchSiteRequest,
@@ -92,7 +91,6 @@ class Client {
92
91
 
93
92
  createRoutine(params: CreateRoutineRequest) {
94
93
  const request = new CreateRoutineRequest(params);
95
- log('Creating routine with parameters:', JSON.stringify(params));
96
94
  return this.callApi(
97
95
  this.client.createRoutine.bind(this.client) as ApiMethod<
98
96
  CreateRoutineRequest,