@open-loyalty/mcp-server 1.3.5 → 1.3.6
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.
|
@@ -49,12 +49,16 @@ export async function rewardCreate(input) {
|
|
|
49
49
|
// API requires: translations (name only), reward (type), activity, visibility
|
|
50
50
|
// NOTE: usageLimit only accepts { perUser: N } - API rejects 'general' as extra field
|
|
51
51
|
// NOTE: description is NOT supported by the API at creation time
|
|
52
|
+
// Sanitize usageLimit - ONLY pass perUser, strip any other fields (like 'general')
|
|
53
|
+
const sanitizedUsageLimit = input.usageLimit?.perUser !== undefined
|
|
54
|
+
? { perUser: input.usageLimit.perUser }
|
|
55
|
+
: undefined;
|
|
52
56
|
const payload = omitUndefined({
|
|
53
57
|
translations: input.translations,
|
|
54
58
|
reward: input.reward,
|
|
55
59
|
activity: input.activity,
|
|
56
60
|
visibility: input.visibility,
|
|
57
|
-
usageLimit:
|
|
61
|
+
usageLimit: sanitizedUsageLimit,
|
|
58
62
|
costInPoints: input.costInPoints,
|
|
59
63
|
usageInstruction: input.usageInstruction,
|
|
60
64
|
active: input.active,
|
|
@@ -70,7 +70,7 @@ export declare const rewardToolDefinitions: readonly [{
|
|
|
70
70
|
}>;
|
|
71
71
|
usageLimit: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
72
72
|
perUser: import("zod").ZodNumber;
|
|
73
|
-
}, "
|
|
73
|
+
}, "strict", import("zod").ZodTypeAny, {
|
|
74
74
|
perUser: number;
|
|
75
75
|
}, {
|
|
76
76
|
perUser: number;
|
|
@@ -27,9 +27,10 @@ const RewardVisibilityInputSchema = z.object({
|
|
|
27
27
|
to: z.string().describe("Visibility end datetime (format: 'YYYY-MM-DD HH:mm'). REQUIRED."),
|
|
28
28
|
});
|
|
29
29
|
// Usage limit schema - API only accepts perUser (NOT general)
|
|
30
|
+
// Using .strict() to reject extra fields with clear error
|
|
30
31
|
const RewardUsageLimitInputSchema = z.object({
|
|
31
|
-
perUser: z.number().describe("Maximum redemptions per member."),
|
|
32
|
-
}).describe("Usage limits. ⚠️
|
|
32
|
+
perUser: z.number().describe("Maximum redemptions per member. This is the ONLY supported field."),
|
|
33
|
+
}).strict().describe("Usage limits. ⚠️ ONLY 'perUser' is supported. Do NOT pass 'general' or any other field - they will be rejected.");
|
|
33
34
|
export const RewardCreateInputSchema = {
|
|
34
35
|
storeCode: z.string().optional().describe("Store code for multi-tenant routing. DO NOT pass this parameter - the configured default will be used automatically. Only provide a value if the user explicitly asks to work with a different store."),
|
|
35
36
|
translations: RewardTranslationsInputSchema.describe("Reward name translations. At least 'en' key with { name } is REQUIRED."),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-loyalty/mcp-server",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "MCP server for Open Loyalty API - enables AI agents to manage loyalty programs, members, points, rewards, and transactions",
|
|
6
6
|
"author": "Marcin Dyguda <md@openloyalty.io>",
|