@comando.one/mcp-server 0.3.0 → 0.3.1
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 +21 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3415,6 +3415,22 @@ function augmentInputSchema(schema, opts) {
|
|
|
3415
3415
|
}
|
|
3416
3416
|
return { ...schema, properties };
|
|
3417
3417
|
}
|
|
3418
|
+
function coerceObjectArg(value) {
|
|
3419
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
3420
|
+
return value;
|
|
3421
|
+
}
|
|
3422
|
+
if (typeof value === "string" && value.trim()) {
|
|
3423
|
+
try {
|
|
3424
|
+
const parsed = JSON.parse(value);
|
|
3425
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
3426
|
+
return parsed;
|
|
3427
|
+
}
|
|
3428
|
+
} catch {
|
|
3429
|
+
return void 0;
|
|
3430
|
+
}
|
|
3431
|
+
}
|
|
3432
|
+
return void 0;
|
|
3433
|
+
}
|
|
3418
3434
|
function destructiveBlocked(args) {
|
|
3419
3435
|
if (args.confirm === true) return null;
|
|
3420
3436
|
return fail(
|
|
@@ -3463,7 +3479,7 @@ function buildCuratedTools(api, heldScopes) {
|
|
|
3463
3479
|
if (blocked && args.dry_run !== true) return blocked;
|
|
3464
3480
|
}
|
|
3465
3481
|
const path = buildPath(desc, args);
|
|
3466
|
-
const body = desc.hasBody ? args.body : void 0;
|
|
3482
|
+
const body = desc.hasBody ? coerceObjectArg(args.body) : void 0;
|
|
3467
3483
|
if (args.dry_run === true) {
|
|
3468
3484
|
return ok({
|
|
3469
3485
|
dry_run: true,
|
|
@@ -3527,15 +3543,16 @@ function buildRequestTool(api) {
|
|
|
3527
3543
|
}
|
|
3528
3544
|
let path = String(args.path ?? "");
|
|
3529
3545
|
if (!path.startsWith("/")) return fail("path deve come\xE7ar com / (ex.: /customers).");
|
|
3530
|
-
|
|
3546
|
+
const queryArg = coerceObjectArg(args.query);
|
|
3547
|
+
if (queryArg) {
|
|
3531
3548
|
const u = new URLSearchParams();
|
|
3532
|
-
for (const [k, v] of Object.entries(
|
|
3549
|
+
for (const [k, v] of Object.entries(queryArg)) {
|
|
3533
3550
|
if (v !== void 0 && v !== null && v !== "") u.set(k, String(v));
|
|
3534
3551
|
}
|
|
3535
3552
|
const s = u.toString();
|
|
3536
3553
|
if (s) path += (path.includes("?") ? "&" : "?") + s;
|
|
3537
3554
|
}
|
|
3538
|
-
const body = args.body
|
|
3555
|
+
const body = coerceObjectArg(args.body);
|
|
3539
3556
|
if (args.dry_run === true) {
|
|
3540
3557
|
return ok({ dry_run: true, method, path, body: body ?? null });
|
|
3541
3558
|
}
|
package/package.json
CHANGED