mcp-zenskar 1.0.10 → 1.0.11
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/server.js +26 -0
package/package.json
CHANGED
package/src/server.js
CHANGED
|
@@ -378,6 +378,32 @@ async function executeAPICall(tool, args) {
|
|
|
378
378
|
}
|
|
379
379
|
});
|
|
380
380
|
|
|
381
|
+
// Nest flat address_* fields into an address object for the Zenskar API
|
|
382
|
+
if (tool.name === 'createCustomer') {
|
|
383
|
+
const addressFieldMap = {
|
|
384
|
+
address_line1: 'line1',
|
|
385
|
+
address_line2: 'line2',
|
|
386
|
+
address_city: 'city',
|
|
387
|
+
address_state: 'state',
|
|
388
|
+
address_zipCode: 'zipCode',
|
|
389
|
+
address_country: 'country',
|
|
390
|
+
address_country_code: 'country_code'
|
|
391
|
+
};
|
|
392
|
+
const addressObj = {};
|
|
393
|
+
let hasAddress = false;
|
|
394
|
+
Object.entries(addressFieldMap).forEach(([flatKey, nestedKey]) => {
|
|
395
|
+
if (bodyParams[flatKey] !== undefined) {
|
|
396
|
+
addressObj[nestedKey] = bodyParams[flatKey];
|
|
397
|
+
delete bodyParams[flatKey];
|
|
398
|
+
hasAddress = true;
|
|
399
|
+
}
|
|
400
|
+
});
|
|
401
|
+
if (hasAddress) {
|
|
402
|
+
bodyParams.address = addressObj;
|
|
403
|
+
logger.debug(`[${tool.name}] Transformed flat address fields into address object`);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
|
|
381
407
|
// Smart defaults for helper tools
|
|
382
408
|
if (tool.name === 'extractContractFromRaw') {
|
|
383
409
|
// Auto-populate organization_id from user context or env var if not provided
|