@sellhapi/mcp 0.1.4 → 0.1.5
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/tools/commerce.js +28 -0
- package/package.json +1 -1
package/dist/tools/commerce.js
CHANGED
|
@@ -72,6 +72,34 @@ function registerCommerceTools(server) {
|
|
|
72
72
|
const data = await (0, client_js_1.get)("/api/mcp/appointments/services");
|
|
73
73
|
return JSON.stringify(data.services, null, 2);
|
|
74
74
|
}));
|
|
75
|
+
// ── Discounts ─────────────────────────────────────────────────────────────
|
|
76
|
+
server.registerTool("list_discounts", {
|
|
77
|
+
title: "List Discounts",
|
|
78
|
+
description: "List all active discounts for this vendor. Returns id, name, code, discountType, value, scope, usage count, and expiry. Use this to check existing discounts before creating new ones.",
|
|
79
|
+
annotations: { readOnlyHint: true },
|
|
80
|
+
}, async () => (0, util_js_1.safeCall)(async () => {
|
|
81
|
+
const data = await (0, client_js_1.get)("/api/mcp/discounts");
|
|
82
|
+
return JSON.stringify(data.discounts, null, 2);
|
|
83
|
+
}));
|
|
84
|
+
server.registerTool("create_discount", {
|
|
85
|
+
title: "Create Discount",
|
|
86
|
+
description: "Create a discount code or automatic discount. For percentage discounts, value is 1–100 (e.g. 20 = 20% off). For fixed discounts, value is in kobo (₦1 = 100 kobo) — the API converts to Naira internally. minimumOrderKobo is also in kobo. scope 'all_products' applies sitewide. 'specific_products' and 'specific_categories' require editing via the dashboard after creation. code is optional — omit for automatic (no-code) discounts.",
|
|
87
|
+
inputSchema: {
|
|
88
|
+
name: v4_1.z.string().describe("Internal discount name e.g. 'Lagos Launch 20% Off'"),
|
|
89
|
+
discountType: v4_1.z.enum(["percentage", "fixed"]).describe("percentage = % off, fixed = fixed Naira amount off"),
|
|
90
|
+
value: v4_1.z.number().describe("For percentage: 1–100. For fixed: amount in kobo (₦1 = 100 kobo)."),
|
|
91
|
+
code: v4_1.z.string().optional().describe("Discount code customers enter at checkout (e.g. 'LAUNCH20'). Omit for automatic discount."),
|
|
92
|
+
description: v4_1.z.string().optional().describe("Internal description"),
|
|
93
|
+
scope: v4_1.z.enum(["all_products", "specific_products", "specific_categories"]).optional().default("all_products").describe("Which products this applies to. specific_products/specific_categories require assigning products in the dashboard after creation."),
|
|
94
|
+
usageLimit: v4_1.z.number().int().min(1).optional().describe("Maximum total uses. Omit for unlimited."),
|
|
95
|
+
minimumOrderKobo: v4_1.z.number().int().min(0).optional().describe("Minimum cart total in kobo to qualify for this discount."),
|
|
96
|
+
expiresAt: v4_1.z.string().optional().describe("Expiry datetime — ISO 8601 string. Omit for no expiry."),
|
|
97
|
+
startsAt: v4_1.z.string().optional().describe("Start datetime — ISO 8601 string. Omit to activate immediately."),
|
|
98
|
+
},
|
|
99
|
+
}, async (input) => (0, util_js_1.safeCall)(async () => {
|
|
100
|
+
const data = await (0, client_js_1.post)("/api/mcp/discounts", input);
|
|
101
|
+
return JSON.stringify(data, null, 2);
|
|
102
|
+
}));
|
|
75
103
|
// ── Categories ────────────────────────────────────────────────────────────
|
|
76
104
|
server.registerTool("list_categories", {
|
|
77
105
|
title: "List Categories",
|