mcp-zenskar 1.0.11 → 1.0.12
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/package.json +1 -1
- package/src/mcp-config.json +63 -0
- package/src/server.js +27 -22
package/package.json
CHANGED
package/src/mcp-config.json
CHANGED
|
@@ -2173,6 +2173,13 @@
|
|
|
2173
2173
|
"required": false,
|
|
2174
2174
|
"position": "body"
|
|
2175
2175
|
},
|
|
2176
|
+
{
|
|
2177
|
+
"name": "address_line3",
|
|
2178
|
+
"description": "Address line 3 (optional).",
|
|
2179
|
+
"type": "string",
|
|
2180
|
+
"required": false,
|
|
2181
|
+
"position": "body"
|
|
2182
|
+
},
|
|
2176
2183
|
{
|
|
2177
2184
|
"name": "address_city",
|
|
2178
2185
|
"description": "Address city (optional).",
|
|
@@ -2208,6 +2215,62 @@
|
|
|
2208
2215
|
"required": false,
|
|
2209
2216
|
"position": "body"
|
|
2210
2217
|
},
|
|
2218
|
+
{
|
|
2219
|
+
"name": "ship_to_line1",
|
|
2220
|
+
"description": "Shipping address line 1 (optional).",
|
|
2221
|
+
"type": "string",
|
|
2222
|
+
"required": false,
|
|
2223
|
+
"position": "body"
|
|
2224
|
+
},
|
|
2225
|
+
{
|
|
2226
|
+
"name": "ship_to_line2",
|
|
2227
|
+
"description": "Shipping address line 2 (optional).",
|
|
2228
|
+
"type": "string",
|
|
2229
|
+
"required": false,
|
|
2230
|
+
"position": "body"
|
|
2231
|
+
},
|
|
2232
|
+
{
|
|
2233
|
+
"name": "ship_to_line3",
|
|
2234
|
+
"description": "Shipping address line 3 (optional).",
|
|
2235
|
+
"type": "string",
|
|
2236
|
+
"required": false,
|
|
2237
|
+
"position": "body"
|
|
2238
|
+
},
|
|
2239
|
+
{
|
|
2240
|
+
"name": "ship_to_city",
|
|
2241
|
+
"description": "Shipping address city (optional).",
|
|
2242
|
+
"type": "string",
|
|
2243
|
+
"required": false,
|
|
2244
|
+
"position": "body"
|
|
2245
|
+
},
|
|
2246
|
+
{
|
|
2247
|
+
"name": "ship_to_state",
|
|
2248
|
+
"description": "Shipping address state (optional).",
|
|
2249
|
+
"type": "string",
|
|
2250
|
+
"required": false,
|
|
2251
|
+
"position": "body"
|
|
2252
|
+
},
|
|
2253
|
+
{
|
|
2254
|
+
"name": "ship_to_zipCode",
|
|
2255
|
+
"description": "Shipping address zip code (optional).",
|
|
2256
|
+
"type": "string",
|
|
2257
|
+
"required": false,
|
|
2258
|
+
"position": "body"
|
|
2259
|
+
},
|
|
2260
|
+
{
|
|
2261
|
+
"name": "ship_to_country",
|
|
2262
|
+
"description": "Shipping address country (optional).",
|
|
2263
|
+
"type": "string",
|
|
2264
|
+
"required": false,
|
|
2265
|
+
"position": "body"
|
|
2266
|
+
},
|
|
2267
|
+
{
|
|
2268
|
+
"name": "ship_to_country_code",
|
|
2269
|
+
"description": "Shipping address country code (optional).",
|
|
2270
|
+
"type": "string",
|
|
2271
|
+
"required": false,
|
|
2272
|
+
"position": "body"
|
|
2273
|
+
},
|
|
2211
2274
|
{
|
|
2212
2275
|
"name": "communications_enabled",
|
|
2213
2276
|
"description": "Enable/disable communications (defaults to true).",
|
package/src/server.js
CHANGED
|
@@ -378,30 +378,35 @@ async function executeAPICall(tool, args) {
|
|
|
378
378
|
}
|
|
379
379
|
});
|
|
380
380
|
|
|
381
|
-
// Nest flat
|
|
381
|
+
// Nest flat address fields into address/ship_to_address objects for the Zenskar API
|
|
382
382
|
if (tool.name === 'createCustomer') {
|
|
383
|
-
const
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
383
|
+
const nestAddress = (prefix, targetKey) => {
|
|
384
|
+
const fieldMap = {
|
|
385
|
+
[`${prefix}line1`]: 'line1',
|
|
386
|
+
[`${prefix}line2`]: 'line2',
|
|
387
|
+
[`${prefix}line3`]: 'line3',
|
|
388
|
+
[`${prefix}city`]: 'city',
|
|
389
|
+
[`${prefix}state`]: 'state',
|
|
390
|
+
[`${prefix}zipCode`]: 'zipCode',
|
|
391
|
+
[`${prefix}country`]: 'country',
|
|
392
|
+
[`${prefix}country_code`]: 'country_code'
|
|
393
|
+
};
|
|
394
|
+
const obj = {};
|
|
395
|
+
let has = false;
|
|
396
|
+
Object.entries(fieldMap).forEach(([flatKey, nestedKey]) => {
|
|
397
|
+
if (bodyParams[flatKey] !== undefined) {
|
|
398
|
+
obj[nestedKey] = bodyParams[flatKey];
|
|
399
|
+
delete bodyParams[flatKey];
|
|
400
|
+
has = true;
|
|
401
|
+
}
|
|
402
|
+
});
|
|
403
|
+
if (has) {
|
|
404
|
+
bodyParams[targetKey] = obj;
|
|
405
|
+
logger.debug(`[${tool.name}] Transformed flat ${prefix}* fields into ${targetKey} object`);
|
|
399
406
|
}
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
logger.debug(`[${tool.name}] Transformed flat address fields into address object`);
|
|
404
|
-
}
|
|
407
|
+
};
|
|
408
|
+
nestAddress('address_', 'address');
|
|
409
|
+
nestAddress('ship_to_', 'ship_to_address');
|
|
405
410
|
}
|
|
406
411
|
|
|
407
412
|
// Smart defaults for helper tools
|