@wildix/wim-tools-client 0.0.11 → 0.0.13

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.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ToolExecutionException = exports.ToolHandler = exports.ToolMcpTransport = exports.ToolVariableType = exports.ToolAuthorizationType = exports.ToolEmailHandler = exports.ToolChatHandler = exports.ToolStringValue = exports.AlreadyExistException = exports.ValidationException = exports.NotFoundException = void 0;
3
+ exports.ToolExecutionException = exports.ToolVariableType = exports.ToolHandler = exports.ToolMcpTransport = exports.ToolAuthorizationType = exports.ToolEmailHandler = exports.ToolChatHandler = exports.ToolStringValue = exports.AlreadyExistException = exports.ValidationException = exports.NotFoundException = void 0;
4
4
  const ToolsServiceException_1 = require("./ToolsServiceException");
5
5
  class NotFoundException extends ToolsServiceException_1.ToolsServiceException {
6
6
  name = "NotFoundException";
@@ -78,14 +78,6 @@ exports.ToolAuthorizationType = {
78
78
  BASIC: "Basic",
79
79
  BEARER: "Bearer",
80
80
  };
81
- exports.ToolVariableType = {
82
- BOOLEAN: "boolean",
83
- NUMBER: "number",
84
- NUMBER_ARRAY: "number_array",
85
- OBJECT: "object",
86
- STRING: "string",
87
- STRING_ARRAY: "string_array",
88
- };
89
81
  exports.ToolMcpTransport = {
90
82
  HTTP: "http",
91
83
  SSE: "sse",
@@ -107,6 +99,13 @@ var ToolHandler;
107
99
  return visitor._(value.$unknown[0], value.$unknown[1]);
108
100
  };
109
101
  })(ToolHandler || (exports.ToolHandler = ToolHandler = {}));
102
+ exports.ToolVariableType = {
103
+ BOOLEAN: "boolean",
104
+ NUMBER: "number",
105
+ NUMBER_ARRAY: "number_array",
106
+ STRING: "string",
107
+ STRING_ARRAY: "string_array",
108
+ };
110
109
  class ToolExecutionException extends ToolsServiceException_1.ToolsServiceException {
111
110
  name = "ToolExecutionException";
112
111
  $fault = "server";
@@ -8,62 +8,73 @@ const core_2 = require("@smithy/core");
8
8
  const smithy_client_1 = require("@smithy/smithy-client");
9
9
  const se_CreateToolCommand = async (input, context) => {
10
10
  const b = (0, core_2.requestBuilder)(input, context);
11
- const headers = (0, smithy_client_1.map)({}, smithy_client_1.isSerializableHeaderValue, {
11
+ const headers = {
12
12
  'content-type': 'application/json',
13
- [_xci]: input[_c],
14
- });
13
+ };
15
14
  b.bp("/v1/tools");
15
+ const query = (0, smithy_client_1.map)({
16
+ [_c]: [, input[_c]],
17
+ });
16
18
  let body;
17
19
  body = JSON.stringify((0, smithy_client_1.take)(input, {
20
+ 'category': [],
18
21
  'description': [],
19
- 'handler': _ => (0, smithy_client_1._json)(_),
22
+ 'handler': _ => se_ToolHandler(_, context),
20
23
  'input': _ => (0, smithy_client_1._json)(_),
21
24
  'name': [],
22
25
  }));
23
26
  b.m("POST")
24
27
  .h(headers)
28
+ .q(query)
25
29
  .b(body);
26
30
  return b.build();
27
31
  };
28
32
  exports.se_CreateToolCommand = se_CreateToolCommand;
29
33
  const se_DeleteToolCommand = async (input, context) => {
30
34
  const b = (0, core_2.requestBuilder)(input, context);
31
- const headers = (0, smithy_client_1.map)({}, smithy_client_1.isSerializableHeaderValue, {
32
- [_xci]: input[_c],
33
- });
35
+ const headers = {};
34
36
  b.bp("/v1/tools/{toolId}");
35
37
  b.p('toolId', () => input.toolId, '{toolId}', false);
38
+ const query = (0, smithy_client_1.map)({
39
+ [_c]: [, input[_c]],
40
+ });
36
41
  let body;
37
42
  b.m("DELETE")
38
43
  .h(headers)
44
+ .q(query)
39
45
  .b(body);
40
46
  return b.build();
41
47
  };
42
48
  exports.se_DeleteToolCommand = se_DeleteToolCommand;
43
49
  const se_DescribeToolsCommand = async (input, context) => {
44
50
  const b = (0, core_2.requestBuilder)(input, context);
45
- const headers = (0, smithy_client_1.map)({}, smithy_client_1.isSerializableHeaderValue, {
51
+ const headers = {
46
52
  'content-type': 'application/json',
47
- [_xci]: input[_c],
48
- });
53
+ };
49
54
  b.bp("/v1/tools/describe");
55
+ const query = (0, smithy_client_1.map)({
56
+ [_c]: [, input[_c]],
57
+ });
50
58
  let body;
51
59
  body = JSON.stringify((0, smithy_client_1.take)(input, {
52
60
  'ids': _ => (0, smithy_client_1._json)(_),
53
61
  }));
54
62
  b.m("POST")
55
63
  .h(headers)
64
+ .q(query)
56
65
  .b(body);
57
66
  return b.build();
58
67
  };
59
68
  exports.se_DescribeToolsCommand = se_DescribeToolsCommand;
60
69
  const se_ExecuteToolCommand = async (input, context) => {
61
70
  const b = (0, core_2.requestBuilder)(input, context);
62
- const headers = (0, smithy_client_1.map)({}, smithy_client_1.isSerializableHeaderValue, {
71
+ const headers = {
63
72
  'content-type': 'application/json',
64
- [_xci]: input[_c],
65
- });
73
+ };
66
74
  b.bp("/v1/tools/execute");
75
+ const query = (0, smithy_client_1.map)({
76
+ [_c]: [, input[_c]],
77
+ });
67
78
  let body;
68
79
  body = JSON.stringify((0, smithy_client_1.take)(input, {
69
80
  'id': [],
@@ -71,6 +82,7 @@ const se_ExecuteToolCommand = async (input, context) => {
71
82
  }));
72
83
  b.m("POST")
73
84
  .h(headers)
85
+ .q(query)
74
86
  .b(body);
75
87
  return b.build();
76
88
  };
@@ -93,34 +105,40 @@ const se_GetToolCommand = async (input, context) => {
93
105
  exports.se_GetToolCommand = se_GetToolCommand;
94
106
  const se_ListToolsCommand = async (input, context) => {
95
107
  const b = (0, core_2.requestBuilder)(input, context);
96
- const headers = (0, smithy_client_1.map)({}, smithy_client_1.isSerializableHeaderValue, {
97
- [_xci]: input[_c],
98
- });
108
+ const headers = {};
99
109
  b.bp("/v1/tools");
110
+ const query = (0, smithy_client_1.map)({
111
+ [_c]: [, input[_c]],
112
+ });
100
113
  let body;
101
114
  b.m("GET")
102
115
  .h(headers)
116
+ .q(query)
103
117
  .b(body);
104
118
  return b.build();
105
119
  };
106
120
  exports.se_ListToolsCommand = se_ListToolsCommand;
107
121
  const se_UpdateToolCommand = async (input, context) => {
108
122
  const b = (0, core_2.requestBuilder)(input, context);
109
- const headers = (0, smithy_client_1.map)({}, smithy_client_1.isSerializableHeaderValue, {
123
+ const headers = {
110
124
  'content-type': 'application/json',
111
- [_xci]: input[_c],
112
- });
125
+ };
113
126
  b.bp("/v1/tools/{toolId}");
114
127
  b.p('toolId', () => input.toolId, '{toolId}', false);
128
+ const query = (0, smithy_client_1.map)({
129
+ [_c]: [, input[_c]],
130
+ });
115
131
  let body;
116
132
  body = JSON.stringify((0, smithy_client_1.take)(input, {
133
+ 'category': [],
117
134
  'description': [],
118
- 'handler': _ => (0, smithy_client_1._json)(_),
135
+ 'handler': _ => se_ToolHandler(_, context),
119
136
  'input': _ => (0, smithy_client_1._json)(_),
120
137
  'name': [],
121
138
  }));
122
139
  b.m("PUT")
123
140
  .h(headers)
141
+ .q(query)
124
142
  .b(body);
125
143
  return b.build();
126
144
  };
@@ -134,7 +152,7 @@ const de_CreateToolCommand = async (output, context) => {
134
152
  });
135
153
  const data = (0, smithy_client_1.expectNonNull)(((0, smithy_client_1.expectObject)(await (0, core_1.parseJsonBody)(output.body, context))), "body");
136
154
  const doc = (0, smithy_client_1.take)(data, {
137
- 'tool': smithy_client_1._json,
155
+ 'tool': _ => de_Tool(_, context),
138
156
  });
139
157
  Object.assign(contents, doc);
140
158
  return contents;
@@ -190,7 +208,7 @@ const de_GetToolCommand = async (output, context) => {
190
208
  });
191
209
  const data = (0, smithy_client_1.expectNonNull)(((0, smithy_client_1.expectObject)(await (0, core_1.parseJsonBody)(output.body, context))), "body");
192
210
  const doc = (0, smithy_client_1.take)(data, {
193
- 'tool': smithy_client_1._json,
211
+ 'tool': _ => de_Tool(_, context),
194
212
  });
195
213
  Object.assign(contents, doc);
196
214
  return contents;
@@ -205,7 +223,7 @@ const de_ListToolsCommand = async (output, context) => {
205
223
  });
206
224
  const data = (0, smithy_client_1.expectNonNull)(((0, smithy_client_1.expectObject)(await (0, core_1.parseJsonBody)(output.body, context))), "body");
207
225
  const doc = (0, smithy_client_1.take)(data, {
208
- 'tools': smithy_client_1._json,
226
+ 'tools': _ => de_ToolsList(_, context),
209
227
  });
210
228
  Object.assign(contents, doc);
211
229
  return contents;
@@ -220,7 +238,7 @@ const de_UpdateToolCommand = async (output, context) => {
220
238
  });
221
239
  const data = (0, smithy_client_1.expectNonNull)(((0, smithy_client_1.expectObject)(await (0, core_1.parseJsonBody)(output.body, context))), "body");
222
240
  const doc = (0, smithy_client_1.take)(data, {
223
- 'tool': smithy_client_1._json,
241
+ 'tool': _ => de_Tool(_, context),
224
242
  });
225
243
  Object.assign(contents, doc);
226
244
  return contents;
@@ -311,9 +329,51 @@ const de_ToolExecutionExceptionRes = async (parsedOutput, context) => {
311
329
  const se_Document = (input, context) => {
312
330
  return input;
313
331
  };
332
+ const se_ToolHandler = (input, context) => {
333
+ return models_0_1.ToolHandler.visit(input, {
334
+ chat: value => ({ "chat": (0, smithy_client_1._json)(value) }),
335
+ email: value => ({ "email": (0, smithy_client_1._json)(value) }),
336
+ mcp: value => ({ "mcp": se_ToolMcpHandler(value, context) }),
337
+ sms: value => ({ "sms": (0, smithy_client_1._json)(value) }),
338
+ webhook: value => ({ "webhook": (0, smithy_client_1._json)(value) }),
339
+ _: (name, value) => ({ [name]: value })
340
+ });
341
+ };
342
+ const se_ToolMcpHandler = (input, context) => {
343
+ return (0, smithy_client_1.take)(input, {
344
+ 'authentication': smithy_client_1._json,
345
+ 'serverUrl': [],
346
+ 'timeout': [],
347
+ 'tools': _ => se_ToolMcpToolConfigList(_, context),
348
+ 'transport': [],
349
+ });
350
+ };
351
+ const se_ToolMcpToolConfig = (input, context) => {
352
+ return (0, smithy_client_1.take)(input, {
353
+ 'description': [],
354
+ 'mcpToolId': [],
355
+ 'parameters': _ => se_Document(_, context),
356
+ });
357
+ };
358
+ const se_ToolMcpToolConfigList = (input, context) => {
359
+ return input.filter((e) => e != null).map(entry => {
360
+ return se_ToolMcpToolConfig(entry, context);
361
+ });
362
+ };
314
363
  const de_Document = (output, context) => {
315
364
  return output;
316
365
  };
366
+ const de_Tool = (output, context) => {
367
+ return (0, smithy_client_1.take)(output, {
368
+ 'category': smithy_client_1.expectString,
369
+ 'company': smithy_client_1.expectString,
370
+ 'description': smithy_client_1.expectString,
371
+ 'handler': (_) => de_ToolHandler((0, core_1.awsExpectUnion)(_), context),
372
+ 'id': smithy_client_1.expectString,
373
+ 'input': smithy_client_1._json,
374
+ 'name': smithy_client_1.expectString,
375
+ });
376
+ };
317
377
  const de_ToolExecutionResult = (output, context) => {
318
378
  return (0, smithy_client_1.take)(output, {
319
379
  'error': smithy_client_1._json,
@@ -321,6 +381,62 @@ const de_ToolExecutionResult = (output, context) => {
321
381
  'statusCode': smithy_client_1.expectInt32,
322
382
  });
323
383
  };
384
+ const de_ToolHandler = (output, context) => {
385
+ if (output.chat != null) {
386
+ return {
387
+ chat: (0, smithy_client_1._json)((0, core_1.awsExpectUnion)(output.chat))
388
+ };
389
+ }
390
+ if (output.email != null) {
391
+ return {
392
+ email: (0, smithy_client_1._json)((0, core_1.awsExpectUnion)(output.email))
393
+ };
394
+ }
395
+ if (output.mcp != null) {
396
+ return {
397
+ mcp: de_ToolMcpHandler(output.mcp, context)
398
+ };
399
+ }
400
+ if (output.sms != null) {
401
+ return {
402
+ sms: (0, smithy_client_1._json)(output.sms)
403
+ };
404
+ }
405
+ if (output.webhook != null) {
406
+ return {
407
+ webhook: (0, smithy_client_1._json)(output.webhook)
408
+ };
409
+ }
410
+ return { $unknown: Object.entries(output)[0] };
411
+ };
412
+ const de_ToolMcpHandler = (output, context) => {
413
+ return (0, smithy_client_1.take)(output, {
414
+ 'authentication': smithy_client_1._json,
415
+ 'serverUrl': smithy_client_1.expectString,
416
+ 'timeout': smithy_client_1.expectInt32,
417
+ 'tools': (_) => de_ToolMcpToolConfigList(_, context),
418
+ 'transport': smithy_client_1.expectString,
419
+ });
420
+ };
421
+ const de_ToolMcpToolConfig = (output, context) => {
422
+ return (0, smithy_client_1.take)(output, {
423
+ 'description': smithy_client_1.expectString,
424
+ 'mcpToolId': smithy_client_1.expectString,
425
+ 'parameters': (_) => de_Document(_, context),
426
+ });
427
+ };
428
+ const de_ToolMcpToolConfigList = (output, context) => {
429
+ const retVal = (output || []).filter((e) => e != null).map((entry) => {
430
+ return de_ToolMcpToolConfig(entry, context);
431
+ });
432
+ return retVal;
433
+ };
434
+ const de_ToolsList = (output, context) => {
435
+ const retVal = (output || []).filter((e) => e != null).map((entry) => {
436
+ return de_Tool(entry, context);
437
+ });
438
+ return retVal;
439
+ };
324
440
  const deserializeMetadata = (output) => ({
325
441
  httpStatusCode: output.statusCode,
326
442
  requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
@@ -329,4 +445,3 @@ const deserializeMetadata = (output) => ({
329
445
  });
330
446
  const collectBodyString = (streamBody, context) => (0, smithy_client_1.collectBody)(streamBody, context).then(body => context.utf8Encoder(body));
331
447
  const _c = "company";
332
- const _xci = "x-company-id";
@@ -72,14 +72,6 @@ export const ToolAuthorizationType = {
72
72
  BASIC: "Basic",
73
73
  BEARER: "Bearer",
74
74
  };
75
- export const ToolVariableType = {
76
- BOOLEAN: "boolean",
77
- NUMBER: "number",
78
- NUMBER_ARRAY: "number_array",
79
- OBJECT: "object",
80
- STRING: "string",
81
- STRING_ARRAY: "string_array",
82
- };
83
75
  export const ToolMcpTransport = {
84
76
  HTTP: "http",
85
77
  SSE: "sse",
@@ -101,6 +93,13 @@ export var ToolHandler;
101
93
  return visitor._(value.$unknown[0], value.$unknown[1]);
102
94
  };
103
95
  })(ToolHandler || (ToolHandler = {}));
96
+ export const ToolVariableType = {
97
+ BOOLEAN: "boolean",
98
+ NUMBER: "number",
99
+ NUMBER_ARRAY: "number_array",
100
+ STRING: "string",
101
+ STRING_ARRAY: "string_array",
102
+ };
104
103
  export class ToolExecutionException extends __BaseException {
105
104
  name = "ToolExecutionException";
106
105
  $fault = "server";
@@ -1,63 +1,74 @@
1
1
  import { ToolsServiceException as __BaseException } from "../models/ToolsServiceException";
2
- import { AlreadyExistException, NotFoundException, ToolExecutionException, ValidationException, } from "../models/models_0";
3
- import { loadRestJsonErrorCode, parseJsonBody as parseBody, parseJsonErrorBody as parseErrorBody, } from "@aws-sdk/core";
2
+ import { AlreadyExistException, NotFoundException, ToolExecutionException, ToolHandler, ValidationException, } from "../models/models_0";
3
+ import { awsExpectUnion as __expectUnion, loadRestJsonErrorCode, parseJsonBody as parseBody, parseJsonErrorBody as parseErrorBody, } from "@aws-sdk/core";
4
4
  import { requestBuilder as rb } from "@smithy/core";
5
- import { decorateServiceException as __decorateServiceException, expectInt32 as __expectInt32, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, _json, collectBody, isSerializableHeaderValue, map, take, withBaseException, } from "@smithy/smithy-client";
5
+ import { decorateServiceException as __decorateServiceException, expectInt32 as __expectInt32, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, _json, collectBody, map, take, withBaseException, } from "@smithy/smithy-client";
6
6
  export const se_CreateToolCommand = async (input, context) => {
7
7
  const b = rb(input, context);
8
- const headers = map({}, isSerializableHeaderValue, {
8
+ const headers = {
9
9
  'content-type': 'application/json',
10
- [_xci]: input[_c],
11
- });
10
+ };
12
11
  b.bp("/v1/tools");
12
+ const query = map({
13
+ [_c]: [, input[_c]],
14
+ });
13
15
  let body;
14
16
  body = JSON.stringify(take(input, {
17
+ 'category': [],
15
18
  'description': [],
16
- 'handler': _ => _json(_),
19
+ 'handler': _ => se_ToolHandler(_, context),
17
20
  'input': _ => _json(_),
18
21
  'name': [],
19
22
  }));
20
23
  b.m("POST")
21
24
  .h(headers)
25
+ .q(query)
22
26
  .b(body);
23
27
  return b.build();
24
28
  };
25
29
  export const se_DeleteToolCommand = async (input, context) => {
26
30
  const b = rb(input, context);
27
- const headers = map({}, isSerializableHeaderValue, {
28
- [_xci]: input[_c],
29
- });
31
+ const headers = {};
30
32
  b.bp("/v1/tools/{toolId}");
31
33
  b.p('toolId', () => input.toolId, '{toolId}', false);
34
+ const query = map({
35
+ [_c]: [, input[_c]],
36
+ });
32
37
  let body;
33
38
  b.m("DELETE")
34
39
  .h(headers)
40
+ .q(query)
35
41
  .b(body);
36
42
  return b.build();
37
43
  };
38
44
  export const se_DescribeToolsCommand = async (input, context) => {
39
45
  const b = rb(input, context);
40
- const headers = map({}, isSerializableHeaderValue, {
46
+ const headers = {
41
47
  'content-type': 'application/json',
42
- [_xci]: input[_c],
43
- });
48
+ };
44
49
  b.bp("/v1/tools/describe");
50
+ const query = map({
51
+ [_c]: [, input[_c]],
52
+ });
45
53
  let body;
46
54
  body = JSON.stringify(take(input, {
47
55
  'ids': _ => _json(_),
48
56
  }));
49
57
  b.m("POST")
50
58
  .h(headers)
59
+ .q(query)
51
60
  .b(body);
52
61
  return b.build();
53
62
  };
54
63
  export const se_ExecuteToolCommand = async (input, context) => {
55
64
  const b = rb(input, context);
56
- const headers = map({}, isSerializableHeaderValue, {
65
+ const headers = {
57
66
  'content-type': 'application/json',
58
- [_xci]: input[_c],
59
- });
67
+ };
60
68
  b.bp("/v1/tools/execute");
69
+ const query = map({
70
+ [_c]: [, input[_c]],
71
+ });
61
72
  let body;
62
73
  body = JSON.stringify(take(input, {
63
74
  'id': [],
@@ -65,6 +76,7 @@ export const se_ExecuteToolCommand = async (input, context) => {
65
76
  }));
66
77
  b.m("POST")
67
78
  .h(headers)
79
+ .q(query)
68
80
  .b(body);
69
81
  return b.build();
70
82
  };
@@ -85,33 +97,39 @@ export const se_GetToolCommand = async (input, context) => {
85
97
  };
86
98
  export const se_ListToolsCommand = async (input, context) => {
87
99
  const b = rb(input, context);
88
- const headers = map({}, isSerializableHeaderValue, {
89
- [_xci]: input[_c],
90
- });
100
+ const headers = {};
91
101
  b.bp("/v1/tools");
102
+ const query = map({
103
+ [_c]: [, input[_c]],
104
+ });
92
105
  let body;
93
106
  b.m("GET")
94
107
  .h(headers)
108
+ .q(query)
95
109
  .b(body);
96
110
  return b.build();
97
111
  };
98
112
  export const se_UpdateToolCommand = async (input, context) => {
99
113
  const b = rb(input, context);
100
- const headers = map({}, isSerializableHeaderValue, {
114
+ const headers = {
101
115
  'content-type': 'application/json',
102
- [_xci]: input[_c],
103
- });
116
+ };
104
117
  b.bp("/v1/tools/{toolId}");
105
118
  b.p('toolId', () => input.toolId, '{toolId}', false);
119
+ const query = map({
120
+ [_c]: [, input[_c]],
121
+ });
106
122
  let body;
107
123
  body = JSON.stringify(take(input, {
124
+ 'category': [],
108
125
  'description': [],
109
- 'handler': _ => _json(_),
126
+ 'handler': _ => se_ToolHandler(_, context),
110
127
  'input': _ => _json(_),
111
128
  'name': [],
112
129
  }));
113
130
  b.m("PUT")
114
131
  .h(headers)
132
+ .q(query)
115
133
  .b(body);
116
134
  return b.build();
117
135
  };
@@ -124,7 +142,7 @@ export const de_CreateToolCommand = async (output, context) => {
124
142
  });
125
143
  const data = __expectNonNull((__expectObject(await parseBody(output.body, context))), "body");
126
144
  const doc = take(data, {
127
- 'tool': _json,
145
+ 'tool': _ => de_Tool(_, context),
128
146
  });
129
147
  Object.assign(contents, doc);
130
148
  return contents;
@@ -176,7 +194,7 @@ export const de_GetToolCommand = async (output, context) => {
176
194
  });
177
195
  const data = __expectNonNull((__expectObject(await parseBody(output.body, context))), "body");
178
196
  const doc = take(data, {
179
- 'tool': _json,
197
+ 'tool': _ => de_Tool(_, context),
180
198
  });
181
199
  Object.assign(contents, doc);
182
200
  return contents;
@@ -190,7 +208,7 @@ export const de_ListToolsCommand = async (output, context) => {
190
208
  });
191
209
  const data = __expectNonNull((__expectObject(await parseBody(output.body, context))), "body");
192
210
  const doc = take(data, {
193
- 'tools': _json,
211
+ 'tools': _ => de_ToolsList(_, context),
194
212
  });
195
213
  Object.assign(contents, doc);
196
214
  return contents;
@@ -204,7 +222,7 @@ export const de_UpdateToolCommand = async (output, context) => {
204
222
  });
205
223
  const data = __expectNonNull((__expectObject(await parseBody(output.body, context))), "body");
206
224
  const doc = take(data, {
207
- 'tool': _json,
225
+ 'tool': _ => de_Tool(_, context),
208
226
  });
209
227
  Object.assign(contents, doc);
210
228
  return contents;
@@ -294,9 +312,51 @@ const de_ToolExecutionExceptionRes = async (parsedOutput, context) => {
294
312
  const se_Document = (input, context) => {
295
313
  return input;
296
314
  };
315
+ const se_ToolHandler = (input, context) => {
316
+ return ToolHandler.visit(input, {
317
+ chat: value => ({ "chat": _json(value) }),
318
+ email: value => ({ "email": _json(value) }),
319
+ mcp: value => ({ "mcp": se_ToolMcpHandler(value, context) }),
320
+ sms: value => ({ "sms": _json(value) }),
321
+ webhook: value => ({ "webhook": _json(value) }),
322
+ _: (name, value) => ({ [name]: value })
323
+ });
324
+ };
325
+ const se_ToolMcpHandler = (input, context) => {
326
+ return take(input, {
327
+ 'authentication': _json,
328
+ 'serverUrl': [],
329
+ 'timeout': [],
330
+ 'tools': _ => se_ToolMcpToolConfigList(_, context),
331
+ 'transport': [],
332
+ });
333
+ };
334
+ const se_ToolMcpToolConfig = (input, context) => {
335
+ return take(input, {
336
+ 'description': [],
337
+ 'mcpToolId': [],
338
+ 'parameters': _ => se_Document(_, context),
339
+ });
340
+ };
341
+ const se_ToolMcpToolConfigList = (input, context) => {
342
+ return input.filter((e) => e != null).map(entry => {
343
+ return se_ToolMcpToolConfig(entry, context);
344
+ });
345
+ };
297
346
  const de_Document = (output, context) => {
298
347
  return output;
299
348
  };
349
+ const de_Tool = (output, context) => {
350
+ return take(output, {
351
+ 'category': __expectString,
352
+ 'company': __expectString,
353
+ 'description': __expectString,
354
+ 'handler': (_) => de_ToolHandler(__expectUnion(_), context),
355
+ 'id': __expectString,
356
+ 'input': _json,
357
+ 'name': __expectString,
358
+ });
359
+ };
300
360
  const de_ToolExecutionResult = (output, context) => {
301
361
  return take(output, {
302
362
  'error': _json,
@@ -304,6 +364,62 @@ const de_ToolExecutionResult = (output, context) => {
304
364
  'statusCode': __expectInt32,
305
365
  });
306
366
  };
367
+ const de_ToolHandler = (output, context) => {
368
+ if (output.chat != null) {
369
+ return {
370
+ chat: _json(__expectUnion(output.chat))
371
+ };
372
+ }
373
+ if (output.email != null) {
374
+ return {
375
+ email: _json(__expectUnion(output.email))
376
+ };
377
+ }
378
+ if (output.mcp != null) {
379
+ return {
380
+ mcp: de_ToolMcpHandler(output.mcp, context)
381
+ };
382
+ }
383
+ if (output.sms != null) {
384
+ return {
385
+ sms: _json(output.sms)
386
+ };
387
+ }
388
+ if (output.webhook != null) {
389
+ return {
390
+ webhook: _json(output.webhook)
391
+ };
392
+ }
393
+ return { $unknown: Object.entries(output)[0] };
394
+ };
395
+ const de_ToolMcpHandler = (output, context) => {
396
+ return take(output, {
397
+ 'authentication': _json,
398
+ 'serverUrl': __expectString,
399
+ 'timeout': __expectInt32,
400
+ 'tools': (_) => de_ToolMcpToolConfigList(_, context),
401
+ 'transport': __expectString,
402
+ });
403
+ };
404
+ const de_ToolMcpToolConfig = (output, context) => {
405
+ return take(output, {
406
+ 'description': __expectString,
407
+ 'mcpToolId': __expectString,
408
+ 'parameters': (_) => de_Document(_, context),
409
+ });
410
+ };
411
+ const de_ToolMcpToolConfigList = (output, context) => {
412
+ const retVal = (output || []).filter((e) => e != null).map((entry) => {
413
+ return de_ToolMcpToolConfig(entry, context);
414
+ });
415
+ return retVal;
416
+ };
417
+ const de_ToolsList = (output, context) => {
418
+ const retVal = (output || []).filter((e) => e != null).map((entry) => {
419
+ return de_Tool(entry, context);
420
+ });
421
+ return retVal;
422
+ };
307
423
  const deserializeMetadata = (output) => ({
308
424
  httpStatusCode: output.statusCode,
309
425
  requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
@@ -312,4 +428,3 @@ const deserializeMetadata = (output) => ({
312
428
  });
313
429
  const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then(body => context.utf8Encoder(body));
314
430
  const _c = "company";
315
- const _xci = "x-company-id";
@@ -38,12 +38,13 @@ declare const CreateToolCommand_base: {
38
38
  * const input = { // CreateToolInput
39
39
  * company: "STRING_VALUE",
40
40
  * name: "STRING_VALUE", // required
41
- * description: "STRING_VALUE", // required
41
+ * category: "STRING_VALUE",
42
+ * description: "STRING_VALUE",
42
43
  * input: { // ToolInput
43
44
  * variables: [ // ToolVariableList // required
44
45
  * { // ToolVariable
45
46
  * name: "STRING_VALUE", // required
46
- * type: "string" || "number" || "boolean" || "string_array" || "number_array" || "object", // required
47
+ * type: "string" || "number" || "boolean" || "string_array" || "number_array", // required
47
48
  * description: "STRING_VALUE", // required
48
49
  * required: true || false,
49
50
  * },
@@ -127,22 +128,11 @@ declare const CreateToolCommand_base: {
127
128
  * token: "STRING_VALUE", // required
128
129
  * },
129
130
  * timeout: Number("int"),
130
- * tools: [ // ToolMcpToolList // required
131
- * { // ToolMcpTool
132
- * name: "STRING_VALUE", // required
133
- * input: {
134
- * variables: [ // required
135
- * {
136
- * name: "STRING_VALUE", // required
137
- * type: "string" || "number" || "boolean" || "string_array" || "number_array" || "object", // required
138
- * description: "STRING_VALUE", // required
139
- * required: true || false,
140
- * },
141
- * ],
142
- * },
143
- * params: { // ToolMcpToolParams // required
144
- * "<keys>": "<ToolStringValue>",
145
- * },
131
+ * tools: [ // ToolMcpToolConfigList
132
+ * { // ToolMcpToolConfig
133
+ * mcpToolId: "STRING_VALUE", // required
134
+ * description: "STRING_VALUE",
135
+ * parameters: "DOCUMENT_VALUE",
146
136
  * },
147
137
  * ],
148
138
  * },
@@ -155,12 +145,13 @@ declare const CreateToolCommand_base: {
155
145
  * // id: "STRING_VALUE", // required
156
146
  * // company: "STRING_VALUE", // required
157
147
  * // name: "STRING_VALUE", // required
148
+ * // category: "STRING_VALUE",
158
149
  * // description: "STRING_VALUE",
159
150
  * // input: { // ToolInput
160
151
  * // variables: [ // ToolVariableList // required
161
152
  * // { // ToolVariable
162
153
  * // name: "STRING_VALUE", // required
163
- * // type: "string" || "number" || "boolean" || "string_array" || "number_array" || "object", // required
154
+ * // type: "string" || "number" || "boolean" || "string_array" || "number_array", // required
164
155
  * // description: "STRING_VALUE", // required
165
156
  * // required: true || false,
166
157
  * // },
@@ -244,22 +235,11 @@ declare const CreateToolCommand_base: {
244
235
  * // token: "STRING_VALUE", // required
245
236
  * // },
246
237
  * // timeout: Number("int"),
247
- * // tools: [ // ToolMcpToolList // required
248
- * // { // ToolMcpTool
249
- * // name: "STRING_VALUE", // required
250
- * // input: {
251
- * // variables: [ // required
252
- * // {
253
- * // name: "STRING_VALUE", // required
254
- * // type: "string" || "number" || "boolean" || "string_array" || "number_array" || "object", // required
255
- * // description: "STRING_VALUE", // required
256
- * // required: true || false,
257
- * // },
258
- * // ],
259
- * // },
260
- * // params: { // ToolMcpToolParams // required
261
- * // "<keys>": "<ToolStringValue>",
262
- * // },
238
+ * // tools: [ // ToolMcpToolConfigList
239
+ * // { // ToolMcpToolConfig
240
+ * // mcpToolId: "STRING_VALUE", // required
241
+ * // description: "STRING_VALUE",
242
+ * // parameters: "DOCUMENT_VALUE",
263
243
  * // },
264
244
  * // ],
265
245
  * // },
@@ -52,7 +52,7 @@ declare const DescribeToolsCommand_base: {
52
52
  * // variables: [ // ToolVariableList // required
53
53
  * // { // ToolVariable
54
54
  * // name: "STRING_VALUE", // required
55
- * // type: "string" || "number" || "boolean" || "string_array" || "number_array" || "object", // required
55
+ * // type: "string" || "number" || "boolean" || "string_array" || "number_array", // required
56
56
  * // description: "STRING_VALUE", // required
57
57
  * // required: true || false,
58
58
  * // },
@@ -46,12 +46,13 @@ declare const GetToolCommand_base: {
46
46
  * // id: "STRING_VALUE", // required
47
47
  * // company: "STRING_VALUE", // required
48
48
  * // name: "STRING_VALUE", // required
49
+ * // category: "STRING_VALUE",
49
50
  * // description: "STRING_VALUE",
50
51
  * // input: { // ToolInput
51
52
  * // variables: [ // ToolVariableList // required
52
53
  * // { // ToolVariable
53
54
  * // name: "STRING_VALUE", // required
54
- * // type: "string" || "number" || "boolean" || "string_array" || "number_array" || "object", // required
55
+ * // type: "string" || "number" || "boolean" || "string_array" || "number_array", // required
55
56
  * // description: "STRING_VALUE", // required
56
57
  * // required: true || false,
57
58
  * // },
@@ -135,22 +136,11 @@ declare const GetToolCommand_base: {
135
136
  * // token: "STRING_VALUE", // required
136
137
  * // },
137
138
  * // timeout: Number("int"),
138
- * // tools: [ // ToolMcpToolList // required
139
- * // { // ToolMcpTool
140
- * // name: "STRING_VALUE", // required
141
- * // input: {
142
- * // variables: [ // required
143
- * // {
144
- * // name: "STRING_VALUE", // required
145
- * // type: "string" || "number" || "boolean" || "string_array" || "number_array" || "object", // required
146
- * // description: "STRING_VALUE", // required
147
- * // required: true || false,
148
- * // },
149
- * // ],
150
- * // },
151
- * // params: { // ToolMcpToolParams // required
152
- * // "<keys>": "<ToolStringValue>",
153
- * // },
139
+ * // tools: [ // ToolMcpToolConfigList
140
+ * // { // ToolMcpToolConfig
141
+ * // mcpToolId: "STRING_VALUE", // required
142
+ * // description: "STRING_VALUE",
143
+ * // parameters: "DOCUMENT_VALUE",
154
144
  * // },
155
145
  * // ],
156
146
  * // },
@@ -46,12 +46,13 @@ declare const ListToolsCommand_base: {
46
46
  * // id: "STRING_VALUE", // required
47
47
  * // company: "STRING_VALUE", // required
48
48
  * // name: "STRING_VALUE", // required
49
+ * // category: "STRING_VALUE",
49
50
  * // description: "STRING_VALUE",
50
51
  * // input: { // ToolInput
51
52
  * // variables: [ // ToolVariableList // required
52
53
  * // { // ToolVariable
53
54
  * // name: "STRING_VALUE", // required
54
- * // type: "string" || "number" || "boolean" || "string_array" || "number_array" || "object", // required
55
+ * // type: "string" || "number" || "boolean" || "string_array" || "number_array", // required
55
56
  * // description: "STRING_VALUE", // required
56
57
  * // required: true || false,
57
58
  * // },
@@ -135,22 +136,11 @@ declare const ListToolsCommand_base: {
135
136
  * // token: "STRING_VALUE", // required
136
137
  * // },
137
138
  * // timeout: Number("int"),
138
- * // tools: [ // ToolMcpToolList // required
139
- * // { // ToolMcpTool
140
- * // name: "STRING_VALUE", // required
141
- * // input: {
142
- * // variables: [ // required
143
- * // {
144
- * // name: "STRING_VALUE", // required
145
- * // type: "string" || "number" || "boolean" || "string_array" || "number_array" || "object", // required
146
- * // description: "STRING_VALUE", // required
147
- * // required: true || false,
148
- * // },
149
- * // ],
150
- * // },
151
- * // params: { // ToolMcpToolParams // required
152
- * // "<keys>": "<ToolStringValue>",
153
- * // },
139
+ * // tools: [ // ToolMcpToolConfigList
140
+ * // { // ToolMcpToolConfig
141
+ * // mcpToolId: "STRING_VALUE", // required
142
+ * // description: "STRING_VALUE",
143
+ * // parameters: "DOCUMENT_VALUE",
154
144
  * // },
155
145
  * // ],
156
146
  * // },
@@ -39,12 +39,13 @@ declare const UpdateToolCommand_base: {
39
39
  * company: "STRING_VALUE",
40
40
  * toolId: "STRING_VALUE", // required
41
41
  * name: "STRING_VALUE", // required
42
- * description: "STRING_VALUE", // required
42
+ * category: "STRING_VALUE",
43
+ * description: "STRING_VALUE",
43
44
  * input: { // ToolInput
44
45
  * variables: [ // ToolVariableList // required
45
46
  * { // ToolVariable
46
47
  * name: "STRING_VALUE", // required
47
- * type: "string" || "number" || "boolean" || "string_array" || "number_array" || "object", // required
48
+ * type: "string" || "number" || "boolean" || "string_array" || "number_array", // required
48
49
  * description: "STRING_VALUE", // required
49
50
  * required: true || false,
50
51
  * },
@@ -128,22 +129,11 @@ declare const UpdateToolCommand_base: {
128
129
  * token: "STRING_VALUE", // required
129
130
  * },
130
131
  * timeout: Number("int"),
131
- * tools: [ // ToolMcpToolList // required
132
- * { // ToolMcpTool
133
- * name: "STRING_VALUE", // required
134
- * input: {
135
- * variables: [ // required
136
- * {
137
- * name: "STRING_VALUE", // required
138
- * type: "string" || "number" || "boolean" || "string_array" || "number_array" || "object", // required
139
- * description: "STRING_VALUE", // required
140
- * required: true || false,
141
- * },
142
- * ],
143
- * },
144
- * params: { // ToolMcpToolParams // required
145
- * "<keys>": "<ToolStringValue>",
146
- * },
132
+ * tools: [ // ToolMcpToolConfigList
133
+ * { // ToolMcpToolConfig
134
+ * mcpToolId: "STRING_VALUE", // required
135
+ * description: "STRING_VALUE",
136
+ * parameters: "DOCUMENT_VALUE",
147
137
  * },
148
138
  * ],
149
139
  * },
@@ -156,12 +146,13 @@ declare const UpdateToolCommand_base: {
156
146
  * // id: "STRING_VALUE", // required
157
147
  * // company: "STRING_VALUE", // required
158
148
  * // name: "STRING_VALUE", // required
149
+ * // category: "STRING_VALUE",
159
150
  * // description: "STRING_VALUE",
160
151
  * // input: { // ToolInput
161
152
  * // variables: [ // ToolVariableList // required
162
153
  * // { // ToolVariable
163
154
  * // name: "STRING_VALUE", // required
164
- * // type: "string" || "number" || "boolean" || "string_array" || "number_array" || "object", // required
155
+ * // type: "string" || "number" || "boolean" || "string_array" || "number_array", // required
165
156
  * // description: "STRING_VALUE", // required
166
157
  * // required: true || false,
167
158
  * // },
@@ -245,22 +236,11 @@ declare const UpdateToolCommand_base: {
245
236
  * // token: "STRING_VALUE", // required
246
237
  * // },
247
238
  * // timeout: Number("int"),
248
- * // tools: [ // ToolMcpToolList // required
249
- * // { // ToolMcpTool
250
- * // name: "STRING_VALUE", // required
251
- * // input: {
252
- * // variables: [ // required
253
- * // {
254
- * // name: "STRING_VALUE", // required
255
- * // type: "string" || "number" || "boolean" || "string_array" || "number_array" || "object", // required
256
- * // description: "STRING_VALUE", // required
257
- * // required: true || false,
258
- * // },
259
- * // ],
260
- * // },
261
- * // params: { // ToolMcpToolParams // required
262
- * // "<keys>": "<ToolStringValue>",
263
- * // },
239
+ * // tools: [ // ToolMcpToolConfigList
240
+ * // { // ToolMcpToolConfig
241
+ * // mcpToolId: "STRING_VALUE", // required
242
+ * // description: "STRING_VALUE",
243
+ * // parameters: "DOCUMENT_VALUE",
264
244
  * // },
265
245
  * // ],
266
246
  * // },
@@ -211,44 +211,21 @@ export interface ToolAuthentication {
211
211
  type: ToolAuthorizationType;
212
212
  token: string;
213
213
  }
214
- /**
215
- * @public
216
- * @enum
217
- */
218
- export declare const ToolVariableType: {
219
- readonly BOOLEAN: "boolean";
220
- readonly NUMBER: "number";
221
- readonly NUMBER_ARRAY: "number_array";
222
- readonly OBJECT: "object";
223
- readonly STRING: "string";
224
- readonly STRING_ARRAY: "string_array";
225
- };
226
- /**
227
- * @public
228
- */
229
- export type ToolVariableType = typeof ToolVariableType[keyof typeof ToolVariableType];
230
- /**
231
- * @public
232
- */
233
- export interface ToolVariable {
234
- name: string;
235
- type: ToolVariableType;
236
- description: string;
237
- required?: boolean | undefined;
238
- }
239
214
  /**
240
215
  * @public
241
216
  */
242
- export interface ToolInput {
243
- variables: (ToolVariable)[];
244
- }
245
- /**
246
- * @public
247
- */
248
- export interface ToolMcpTool {
249
- name: string;
250
- input: ToolInput;
251
- params: Record<string, ToolStringValue>;
217
+ export interface ToolMcpToolConfig {
218
+ mcpToolId: string;
219
+ /**
220
+ * Optional description override for the tool
221
+ * @public
222
+ */
223
+ description?: string | undefined;
224
+ /**
225
+ * Parameter mappings for the MCP tool
226
+ * @public
227
+ */
228
+ parameters?: __DocumentType | undefined;
252
229
  }
253
230
  /**
254
231
  * @public
@@ -271,7 +248,11 @@ export interface ToolMcpHandler {
271
248
  transport: ToolMcpTransport;
272
249
  authentication?: ToolAuthentication | undefined;
273
250
  timeout?: number | undefined;
274
- tools: (ToolMcpTool)[];
251
+ /**
252
+ * List of MCP tools to expose from this server
253
+ * @public
254
+ */
255
+ tools?: (ToolMcpToolConfig)[] | undefined;
275
256
  }
276
257
  /**
277
258
  * @public
@@ -361,13 +342,44 @@ export declare namespace ToolHandler {
361
342
  }
362
343
  const visit: <T>(value: ToolHandler, visitor: Visitor<T>) => T;
363
344
  }
345
+ /**
346
+ * @public
347
+ * @enum
348
+ */
349
+ export declare const ToolVariableType: {
350
+ readonly BOOLEAN: "boolean";
351
+ readonly NUMBER: "number";
352
+ readonly NUMBER_ARRAY: "number_array";
353
+ readonly STRING: "string";
354
+ readonly STRING_ARRAY: "string_array";
355
+ };
356
+ /**
357
+ * @public
358
+ */
359
+ export type ToolVariableType = typeof ToolVariableType[keyof typeof ToolVariableType];
360
+ /**
361
+ * @public
362
+ */
363
+ export interface ToolVariable {
364
+ name: string;
365
+ type: ToolVariableType;
366
+ description: string;
367
+ required?: boolean | undefined;
368
+ }
369
+ /**
370
+ * @public
371
+ */
372
+ export interface ToolInput {
373
+ variables: (ToolVariable)[];
374
+ }
364
375
  /**
365
376
  * @public
366
377
  */
367
378
  export interface CreateToolInput {
368
379
  company?: string | undefined;
369
380
  name: string;
370
- description: string;
381
+ category?: string | undefined;
382
+ description?: string | undefined;
371
383
  input: ToolInput;
372
384
  handler: ToolHandler;
373
385
  }
@@ -378,6 +390,7 @@ export interface Tool {
378
390
  id: string;
379
391
  company: string;
380
392
  name: string;
393
+ category?: string | undefined;
381
394
  description?: string | undefined;
382
395
  input: ToolInput;
383
396
  handler: ToolHandler;
@@ -494,7 +507,8 @@ export interface UpdateToolInput {
494
507
  company?: string | undefined;
495
508
  toolId: string;
496
509
  name: string;
497
- description: string;
510
+ category?: string | undefined;
511
+ description?: string | undefined;
498
512
  input: ToolInput;
499
513
  handler: ToolHandler;
500
514
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wildix/wim-tools-client",
3
3
  "description": "@wildix/wim-tools-client client",
4
- "version": "0.0.11",
4
+ "version": "0.0.13",
5
5
  "scripts": {
6
6
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
7
7
  "build:cjs": "tsc -p tsconfig.cjs.json",