@open-loyalty/mcp-server 1.3.7 → 1.5.3

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.
Files changed (100) hide show
  1. package/dist/config.d.ts +4 -3
  2. package/dist/config.js +9 -7
  3. package/dist/instructions.d.ts +1 -1
  4. package/dist/instructions.js +26 -8
  5. package/dist/tools/achievement/handlers.js +60 -1
  6. package/dist/tools/achievement/index.d.ts +8 -8
  7. package/dist/tools/achievement/index.js +10 -11
  8. package/dist/tools/achievement/schemas.d.ts +8 -8
  9. package/dist/tools/achievement/schemas.js +36 -32
  10. package/dist/tools/analytics.js +9 -9
  11. package/dist/tools/badge.js +4 -4
  12. package/dist/tools/campaign/handlers.js +35 -1
  13. package/dist/tools/campaign/index.d.ts +97 -34
  14. package/dist/tools/campaign/index.js +14 -12
  15. package/dist/tools/campaign/schemas.d.ts +96 -33
  16. package/dist/tools/campaign/schemas.js +89 -55
  17. package/dist/tools/custom-event.js +10 -9
  18. package/dist/tools/export.js +4 -4
  19. package/dist/tools/import.d.ts +1 -1
  20. package/dist/tools/import.js +11 -6
  21. package/dist/tools/index.js +4 -4
  22. package/dist/tools/member/handlers.js +48 -1
  23. package/dist/tools/member/index.d.ts +1 -1
  24. package/dist/tools/member/index.js +3 -1
  25. package/dist/tools/member/schemas.js +12 -12
  26. package/dist/tools/points/handlers.d.ts +75 -0
  27. package/dist/tools/{points.js → points/handlers.js} +21 -112
  28. package/dist/tools/points/index.d.ts +84 -0
  29. package/dist/tools/points/index.js +63 -0
  30. package/dist/tools/points/schemas.d.ts +45 -0
  31. package/dist/tools/points/schemas.js +47 -0
  32. package/dist/tools/referral/schemas.js +3 -3
  33. package/dist/tools/reward/handlers.d.ts +2 -0
  34. package/dist/tools/reward/handlers.js +79 -6
  35. package/dist/tools/reward/index.d.ts +2 -0
  36. package/dist/tools/reward/index.js +10 -10
  37. package/dist/tools/reward/schemas.d.ts +2 -0
  38. package/dist/tools/reward/schemas.js +42 -23
  39. package/dist/tools/segment/index.js +7 -5
  40. package/dist/tools/segment/schemas.js +11 -11
  41. package/dist/tools/tierset/handlers.d.ts +26 -0
  42. package/dist/tools/tierset/handlers.js +196 -0
  43. package/dist/tools/tierset/index.d.ts +124 -0
  44. package/dist/tools/tierset/index.js +88 -0
  45. package/dist/tools/tierset/schemas.d.ts +127 -0
  46. package/dist/tools/tierset/schemas.js +62 -0
  47. package/dist/tools/transaction/handlers.d.ts +89 -0
  48. package/dist/tools/transaction/handlers.js +159 -0
  49. package/dist/tools/transaction/index.d.ts +153 -0
  50. package/dist/tools/transaction/index.js +54 -0
  51. package/dist/tools/transaction/schemas.d.ts +126 -0
  52. package/dist/tools/transaction/schemas.js +60 -0
  53. package/dist/tools/wallet-type/handlers.d.ts +63 -0
  54. package/dist/tools/{wallet-type.js → wallet-type/handlers.js} +15 -78
  55. package/dist/tools/{wallet-type.d.ts → wallet-type/index.d.ts} +3 -64
  56. package/dist/tools/wallet-type/index.js +65 -0
  57. package/dist/tools/wallet-type/schemas.d.ts +1 -0
  58. package/dist/tools/wallet-type/schemas.js +1 -0
  59. package/dist/tools/webhook.js +6 -6
  60. package/dist/types/schemas/achievement.d.ts +48 -48
  61. package/dist/types/schemas/admin.d.ts +10 -10
  62. package/dist/types/schemas/campaign.d.ts +12 -12
  63. package/dist/types/schemas/common.js +1 -1
  64. package/dist/types/schemas/member.d.ts +18 -18
  65. package/dist/types/schemas/role.d.ts +4 -4
  66. package/dist/types/schemas/tierset.js +2 -1
  67. package/dist/types/schemas/transaction.d.ts +12 -12
  68. package/dist/types/schemas/wallet-type.js +12 -10
  69. package/dist/types/schemas/webhook.d.ts +6 -6
  70. package/dist/utils/errors.js +40 -0
  71. package/package.json +3 -2
  72. package/dist/prompts/fan-engagement-setup.d.ts +0 -107
  73. package/dist/prompts/fan-engagement-setup.js +0 -492
  74. package/dist/tools/achievement.d.ts +0 -1017
  75. package/dist/tools/achievement.js +0 -354
  76. package/dist/tools/campaign.d.ts +0 -1800
  77. package/dist/tools/campaign.js +0 -737
  78. package/dist/tools/member.d.ts +0 -366
  79. package/dist/tools/member.js +0 -352
  80. package/dist/tools/points.d.ts +0 -201
  81. package/dist/tools/reward.d.ts +0 -279
  82. package/dist/tools/reward.js +0 -361
  83. package/dist/tools/segment.d.ts +0 -816
  84. package/dist/tools/segment.js +0 -333
  85. package/dist/tools/tierset.d.ts +0 -273
  86. package/dist/tools/tierset.js +0 -289
  87. package/dist/tools/transaction.d.ts +0 -365
  88. package/dist/tools/transaction.js +0 -259
  89. package/dist/workflows/app-login-streak.d.ts +0 -39
  90. package/dist/workflows/app-login-streak.js +0 -298
  91. package/dist/workflows/early-arrival.d.ts +0 -33
  92. package/dist/workflows/early-arrival.js +0 -148
  93. package/dist/workflows/index.d.ts +0 -101
  94. package/dist/workflows/index.js +0 -208
  95. package/dist/workflows/match-attendance.d.ts +0 -45
  96. package/dist/workflows/match-attendance.js +0 -308
  97. package/dist/workflows/sportsbar-visit.d.ts +0 -41
  98. package/dist/workflows/sportsbar-visit.js +0 -284
  99. package/dist/workflows/vod-watching.d.ts +0 -43
  100. package/dist/workflows/vod-watching.js +0 -326
@@ -253,11 +253,11 @@ export declare const CampaignVisibilitySchema: z.ZodObject<{
253
253
  tiers: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
254
254
  segments: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
255
255
  }, "strip", z.ZodTypeAny, {
256
- target: "all" | "segment" | "tier";
256
+ target: "all" | "tier" | "segment";
257
257
  tiers?: string[] | undefined;
258
258
  segments?: string[] | undefined;
259
259
  }, {
260
- target: "all" | "segment" | "tier";
260
+ target: "all" | "tier" | "segment";
261
261
  tiers?: string[] | undefined;
262
262
  segments?: string[] | undefined;
263
263
  }>;
@@ -267,11 +267,11 @@ export declare const CampaignAudienceSchema: z.ZodObject<{
267
267
  tiers: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
268
268
  segments: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
269
269
  }, "strip", z.ZodTypeAny, {
270
- target: "all" | "segment" | "tier";
270
+ target: "all" | "tier" | "segment";
271
271
  tiers?: string[] | undefined;
272
272
  segments?: string[] | undefined;
273
273
  }, {
274
- target: "all" | "segment" | "tier";
274
+ target: "all" | "tier" | "segment";
275
275
  tiers?: string[] | undefined;
276
276
  segments?: string[] | undefined;
277
277
  }>;
@@ -733,11 +733,11 @@ export declare const CampaignSchema: z.ZodObject<{
733
733
  tiers: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
734
734
  segments: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
735
735
  }, "strip", z.ZodTypeAny, {
736
- target: "all" | "segment" | "tier";
736
+ target: "all" | "tier" | "segment";
737
737
  tiers?: string[] | undefined;
738
738
  segments?: string[] | undefined;
739
739
  }, {
740
- target: "all" | "segment" | "tier";
740
+ target: "all" | "tier" | "segment";
741
741
  tiers?: string[] | undefined;
742
742
  segments?: string[] | undefined;
743
743
  }>>;
@@ -746,11 +746,11 @@ export declare const CampaignSchema: z.ZodObject<{
746
746
  tiers: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
747
747
  segments: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
748
748
  }, "strip", z.ZodTypeAny, {
749
- target: "all" | "segment" | "tier";
749
+ target: "all" | "tier" | "segment";
750
750
  tiers?: string[] | undefined;
751
751
  segments?: string[] | undefined;
752
752
  }, {
753
- target: "all" | "segment" | "tier";
753
+ target: "all" | "tier" | "segment";
754
754
  tiers?: string[] | undefined;
755
755
  segments?: string[] | undefined;
756
756
  }>>;
@@ -1040,7 +1040,7 @@ export declare const CampaignSchema: z.ZodObject<{
1040
1040
  endsAt?: string | undefined;
1041
1041
  } | undefined;
1042
1042
  visibility?: {
1043
- target: "all" | "segment" | "tier";
1043
+ target: "all" | "tier" | "segment";
1044
1044
  tiers?: string[] | undefined;
1045
1045
  segments?: string[] | undefined;
1046
1046
  } | undefined;
@@ -1049,7 +1049,7 @@ export declare const CampaignSchema: z.ZodObject<{
1049
1049
  key: string;
1050
1050
  }[] | undefined;
1051
1051
  audience?: {
1052
- target: "all" | "segment" | "tier";
1052
+ target: "all" | "tier" | "segment";
1053
1053
  tiers?: string[] | undefined;
1054
1054
  segments?: string[] | undefined;
1055
1055
  } | undefined;
@@ -1140,7 +1140,7 @@ export declare const CampaignSchema: z.ZodObject<{
1140
1140
  endsAt?: string | undefined;
1141
1141
  } | undefined;
1142
1142
  visibility?: {
1143
- target: "all" | "segment" | "tier";
1143
+ target: "all" | "tier" | "segment";
1144
1144
  tiers?: string[] | undefined;
1145
1145
  segments?: string[] | undefined;
1146
1146
  } | undefined;
@@ -1149,7 +1149,7 @@ export declare const CampaignSchema: z.ZodObject<{
1149
1149
  key: string;
1150
1150
  }[] | undefined;
1151
1151
  audience?: {
1152
- target: "all" | "segment" | "tier";
1152
+ target: "all" | "tier" | "segment";
1153
1153
  tiers?: string[] | undefined;
1154
1154
  segments?: string[] | undefined;
1155
1155
  } | undefined;
@@ -3,7 +3,7 @@ import { z } from "zod";
3
3
  * Common storeCode schema used across all tools.
4
4
  * Extracted to single source of truth to avoid 86+ duplications.
5
5
  */
6
- export const StoreCodeSchema = 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.");
6
+ export const StoreCodeSchema = z.string().optional().describe("INTERNAL: Auto-filled from server settings when configured. NEVER prompt for this. Only set if no default is configured or user explicitly requests a different store.");
7
7
  /**
8
8
  * Common schema for paginated list responses.
9
9
  * The Open Loyalty API returns total in varying formats depending on the endpoint:
@@ -68,9 +68,11 @@ export declare const MemberSchema: z.ZodObject<{
68
68
  levelName: z.ZodOptional<z.ZodString>;
69
69
  points: z.ZodOptional<z.ZodNumber>;
70
70
  }, "strip", z.ZodTypeAny, {
71
- email: string;
72
71
  active: boolean;
72
+ email: string;
73
73
  memberId: string;
74
+ createdAt?: string | undefined;
75
+ points?: number | undefined;
74
76
  phone?: string | undefined;
75
77
  address?: {
76
78
  street?: string | undefined;
@@ -84,17 +86,17 @@ export declare const MemberSchema: z.ZodObject<{
84
86
  lastName?: string | undefined;
85
87
  birthDate?: string | undefined;
86
88
  gender?: "male" | "female" | "not_disclosed" | undefined;
87
- createdAt?: string | undefined;
88
- points?: number | undefined;
89
89
  levelId?: string | undefined;
90
90
  agreement1?: boolean | undefined;
91
91
  agreement2?: boolean | undefined;
92
92
  agreement3?: boolean | undefined;
93
93
  levelName?: string | undefined;
94
94
  }, {
95
- email: string;
96
95
  active: boolean;
96
+ email: string;
97
97
  memberId: string;
98
+ createdAt?: string | undefined;
99
+ points?: number | undefined;
98
100
  phone?: string | undefined;
99
101
  address?: {
100
102
  street?: string | undefined;
@@ -108,8 +110,6 @@ export declare const MemberSchema: z.ZodObject<{
108
110
  lastName?: string | undefined;
109
111
  birthDate?: string | undefined;
110
112
  gender?: "male" | "female" | "not_disclosed" | undefined;
111
- createdAt?: string | undefined;
112
- points?: number | undefined;
113
113
  levelId?: string | undefined;
114
114
  agreement1?: boolean | undefined;
115
115
  agreement2?: boolean | undefined;
@@ -129,28 +129,28 @@ export declare const MemberListItemSchema: z.ZodObject<{
129
129
  createdAt: z.ZodOptional<z.ZodString>;
130
130
  registeredAt: z.ZodOptional<z.ZodString>;
131
131
  }, "strip", z.ZodTypeAny, {
132
- email: string;
133
132
  active: boolean;
133
+ email: string;
134
134
  customerId: string;
135
+ createdAt?: string | undefined;
135
136
  phone?: string | undefined;
136
137
  loyaltyCardNumber?: string | undefined;
137
138
  firstName?: string | undefined;
138
139
  lastName?: string | undefined;
139
140
  birthDate?: string | undefined;
140
141
  gender?: string | undefined;
141
- createdAt?: string | undefined;
142
142
  registeredAt?: string | undefined;
143
143
  }, {
144
- email: string;
145
144
  active: boolean;
145
+ email: string;
146
146
  customerId: string;
147
+ createdAt?: string | undefined;
147
148
  phone?: string | undefined;
148
149
  loyaltyCardNumber?: string | undefined;
149
150
  firstName?: string | undefined;
150
151
  lastName?: string | undefined;
151
152
  birthDate?: string | undefined;
152
153
  gender?: string | undefined;
153
- createdAt?: string | undefined;
154
154
  registeredAt?: string | undefined;
155
155
  }>;
156
156
  export declare const MemberListResponseSchema: z.ZodObject<{
@@ -167,28 +167,28 @@ export declare const MemberListResponseSchema: z.ZodObject<{
167
167
  createdAt: z.ZodOptional<z.ZodString>;
168
168
  registeredAt: z.ZodOptional<z.ZodString>;
169
169
  }, "strip", z.ZodTypeAny, {
170
- email: string;
171
170
  active: boolean;
171
+ email: string;
172
172
  customerId: string;
173
+ createdAt?: string | undefined;
173
174
  phone?: string | undefined;
174
175
  loyaltyCardNumber?: string | undefined;
175
176
  firstName?: string | undefined;
176
177
  lastName?: string | undefined;
177
178
  birthDate?: string | undefined;
178
179
  gender?: string | undefined;
179
- createdAt?: string | undefined;
180
180
  registeredAt?: string | undefined;
181
181
  }, {
182
- email: string;
183
182
  active: boolean;
183
+ email: string;
184
184
  customerId: string;
185
+ createdAt?: string | undefined;
185
186
  phone?: string | undefined;
186
187
  loyaltyCardNumber?: string | undefined;
187
188
  firstName?: string | undefined;
188
189
  lastName?: string | undefined;
189
190
  birthDate?: string | undefined;
190
191
  gender?: string | undefined;
191
- createdAt?: string | undefined;
192
192
  registeredAt?: string | undefined;
193
193
  }>, "many">;
194
194
  total: z.ZodObject<{
@@ -206,16 +206,16 @@ export declare const MemberListResponseSchema: z.ZodObject<{
206
206
  }, z.ZodTypeAny, "passthrough">>;
207
207
  }, "strip", z.ZodTypeAny, {
208
208
  items: {
209
- email: string;
210
209
  active: boolean;
210
+ email: string;
211
211
  customerId: string;
212
+ createdAt?: string | undefined;
212
213
  phone?: string | undefined;
213
214
  loyaltyCardNumber?: string | undefined;
214
215
  firstName?: string | undefined;
215
216
  lastName?: string | undefined;
216
217
  birthDate?: string | undefined;
217
218
  gender?: string | undefined;
218
- createdAt?: string | undefined;
219
219
  registeredAt?: string | undefined;
220
220
  }[];
221
221
  total: {
@@ -227,16 +227,16 @@ export declare const MemberListResponseSchema: z.ZodObject<{
227
227
  };
228
228
  }, {
229
229
  items: {
230
- email: string;
231
230
  active: boolean;
231
+ email: string;
232
232
  customerId: string;
233
+ createdAt?: string | undefined;
233
234
  phone?: string | undefined;
234
235
  loyaltyCardNumber?: string | undefined;
235
236
  firstName?: string | undefined;
236
237
  lastName?: string | undefined;
237
238
  birthDate?: string | undefined;
238
239
  gender?: string | undefined;
239
- createdAt?: string | undefined;
240
240
  registeredAt?: string | undefined;
241
241
  }[];
242
242
  total: {
@@ -56,9 +56,9 @@ export declare const RoleSchema: z.ZodObject<{
56
56
  }, "strip", z.ZodTypeAny, {
57
57
  name: string;
58
58
  id: string | number;
59
+ default?: boolean | undefined;
59
60
  role?: string | undefined;
60
61
  master?: boolean | undefined;
61
- default?: boolean | undefined;
62
62
  permissions?: {
63
63
  resource: string;
64
64
  access: string;
@@ -70,9 +70,9 @@ export declare const RoleSchema: z.ZodObject<{
70
70
  }, {
71
71
  name: string;
72
72
  id: string | number;
73
+ default?: boolean | undefined;
73
74
  role?: string | undefined;
74
75
  master?: boolean | undefined;
75
- default?: boolean | undefined;
76
76
  permissions?: {
77
77
  resource: string;
78
78
  access: string;
@@ -116,9 +116,9 @@ export declare const RoleListItemSchema: z.ZodObject<{
116
116
  }, "strip", z.ZodTypeAny, {
117
117
  name: string;
118
118
  id: string | number;
119
+ default?: boolean | undefined;
119
120
  role?: string | undefined;
120
121
  master?: boolean | undefined;
121
- default?: boolean | undefined;
122
122
  permissions?: {
123
123
  resource: string;
124
124
  access: string;
@@ -130,9 +130,9 @@ export declare const RoleListItemSchema: z.ZodObject<{
130
130
  }, {
131
131
  name: string;
132
132
  id: string | number;
133
+ default?: boolean | undefined;
133
134
  role?: string | undefined;
134
135
  master?: boolean | undefined;
135
- default?: boolean | undefined;
136
136
  permissions?: {
137
137
  resource: string;
138
138
  access: string;
@@ -6,7 +6,8 @@ export const TierSetAttributeEnum = z.enum([
6
6
  "totalSpending",
7
7
  "monthsSinceJoiningProgram",
8
8
  "cumulatedEarnedUnits",
9
- ]);
9
+ ]).describe("Condition attribute. IMPORTANT: The field name is 'attribute', NOT 'type'. " +
10
+ "Valid values: activeUnits, totalEarnedUnits, totalSpending, monthsSinceJoiningProgram, cumulatedEarnedUnits.");
10
11
  // Condition schema for tier set - API uses 'id' not 'conditionId'
11
12
  export const TierSetConditionSchema = z.object({
12
13
  id: z.string(),
@@ -141,6 +141,7 @@ export declare const TransactionCustomerDataSchema: z.ZodObject<{
141
141
  address1?: string | undefined;
142
142
  }>>;
143
143
  }, "strip", z.ZodTypeAny, {
144
+ name?: string | undefined;
144
145
  email?: string | undefined;
145
146
  phone?: string | undefined;
146
147
  address?: {
@@ -152,10 +153,10 @@ export declare const TransactionCustomerDataSchema: z.ZodObject<{
152
153
  address1?: string | undefined;
153
154
  } | undefined;
154
155
  loyaltyCardNumber?: string | undefined;
155
- name?: string | undefined;
156
156
  customerId?: string | undefined;
157
157
  nip?: string | undefined;
158
158
  }, {
159
+ name?: string | undefined;
159
160
  email?: string | undefined;
160
161
  phone?: string | undefined;
161
162
  address?: {
@@ -167,7 +168,6 @@ export declare const TransactionCustomerDataSchema: z.ZodObject<{
167
168
  address1?: string | undefined;
168
169
  } | undefined;
169
170
  loyaltyCardNumber?: string | undefined;
170
- name?: string | undefined;
171
171
  customerId?: string | undefined;
172
172
  nip?: string | undefined;
173
173
  }>;
@@ -283,6 +283,7 @@ export declare const TransactionSchema: z.ZodObject<{
283
283
  address1?: string | undefined;
284
284
  }>>;
285
285
  }, "strip", z.ZodTypeAny, {
286
+ name?: string | undefined;
286
287
  email?: string | undefined;
287
288
  phone?: string | undefined;
288
289
  address?: {
@@ -294,10 +295,10 @@ export declare const TransactionSchema: z.ZodObject<{
294
295
  address1?: string | undefined;
295
296
  } | undefined;
296
297
  loyaltyCardNumber?: string | undefined;
297
- name?: string | undefined;
298
298
  customerId?: string | undefined;
299
299
  nip?: string | undefined;
300
300
  }, {
301
+ name?: string | undefined;
301
302
  email?: string | undefined;
302
303
  phone?: string | undefined;
303
304
  address?: {
@@ -309,7 +310,6 @@ export declare const TransactionSchema: z.ZodObject<{
309
310
  address1?: string | undefined;
310
311
  } | undefined;
311
312
  loyaltyCardNumber?: string | undefined;
312
- name?: string | undefined;
313
313
  customerId?: string | undefined;
314
314
  nip?: string | undefined;
315
315
  }>>;
@@ -349,6 +349,7 @@ export declare const TransactionSchema: z.ZodObject<{
349
349
  createdAt?: string | undefined;
350
350
  customerId?: string | undefined;
351
351
  customerData?: {
352
+ name?: string | undefined;
352
353
  email?: string | undefined;
353
354
  phone?: string | undefined;
354
355
  address?: {
@@ -360,7 +361,6 @@ export declare const TransactionSchema: z.ZodObject<{
360
361
  address1?: string | undefined;
361
362
  } | undefined;
362
363
  loyaltyCardNumber?: string | undefined;
363
- name?: string | undefined;
364
364
  customerId?: string | undefined;
365
365
  nip?: string | undefined;
366
366
  } | undefined;
@@ -396,6 +396,7 @@ export declare const TransactionSchema: z.ZodObject<{
396
396
  createdAt?: string | undefined;
397
397
  customerId?: string | undefined;
398
398
  customerData?: {
399
+ name?: string | undefined;
399
400
  email?: string | undefined;
400
401
  phone?: string | undefined;
401
402
  address?: {
@@ -407,7 +408,6 @@ export declare const TransactionSchema: z.ZodObject<{
407
408
  address1?: string | undefined;
408
409
  } | undefined;
409
410
  loyaltyCardNumber?: string | undefined;
410
- name?: string | undefined;
411
411
  customerId?: string | undefined;
412
412
  nip?: string | undefined;
413
413
  } | undefined;
@@ -526,6 +526,7 @@ export declare const TransactionListResponseSchema: z.ZodObject<{
526
526
  address1?: string | undefined;
527
527
  }>>;
528
528
  }, "strip", z.ZodTypeAny, {
529
+ name?: string | undefined;
529
530
  email?: string | undefined;
530
531
  phone?: string | undefined;
531
532
  address?: {
@@ -537,10 +538,10 @@ export declare const TransactionListResponseSchema: z.ZodObject<{
537
538
  address1?: string | undefined;
538
539
  } | undefined;
539
540
  loyaltyCardNumber?: string | undefined;
540
- name?: string | undefined;
541
541
  customerId?: string | undefined;
542
542
  nip?: string | undefined;
543
543
  }, {
544
+ name?: string | undefined;
544
545
  email?: string | undefined;
545
546
  phone?: string | undefined;
546
547
  address?: {
@@ -552,7 +553,6 @@ export declare const TransactionListResponseSchema: z.ZodObject<{
552
553
  address1?: string | undefined;
553
554
  } | undefined;
554
555
  loyaltyCardNumber?: string | undefined;
555
- name?: string | undefined;
556
556
  customerId?: string | undefined;
557
557
  nip?: string | undefined;
558
558
  }>>;
@@ -592,6 +592,7 @@ export declare const TransactionListResponseSchema: z.ZodObject<{
592
592
  createdAt?: string | undefined;
593
593
  customerId?: string | undefined;
594
594
  customerData?: {
595
+ name?: string | undefined;
595
596
  email?: string | undefined;
596
597
  phone?: string | undefined;
597
598
  address?: {
@@ -603,7 +604,6 @@ export declare const TransactionListResponseSchema: z.ZodObject<{
603
604
  address1?: string | undefined;
604
605
  } | undefined;
605
606
  loyaltyCardNumber?: string | undefined;
606
- name?: string | undefined;
607
607
  customerId?: string | undefined;
608
608
  nip?: string | undefined;
609
609
  } | undefined;
@@ -639,6 +639,7 @@ export declare const TransactionListResponseSchema: z.ZodObject<{
639
639
  createdAt?: string | undefined;
640
640
  customerId?: string | undefined;
641
641
  customerData?: {
642
+ name?: string | undefined;
642
643
  email?: string | undefined;
643
644
  phone?: string | undefined;
644
645
  address?: {
@@ -650,7 +651,6 @@ export declare const TransactionListResponseSchema: z.ZodObject<{
650
651
  address1?: string | undefined;
651
652
  } | undefined;
652
653
  loyaltyCardNumber?: string | undefined;
653
- name?: string | undefined;
654
654
  customerId?: string | undefined;
655
655
  nip?: string | undefined;
656
656
  } | undefined;
@@ -701,6 +701,7 @@ export declare const TransactionListResponseSchema: z.ZodObject<{
701
701
  createdAt?: string | undefined;
702
702
  customerId?: string | undefined;
703
703
  customerData?: {
704
+ name?: string | undefined;
704
705
  email?: string | undefined;
705
706
  phone?: string | undefined;
706
707
  address?: {
@@ -712,7 +713,6 @@ export declare const TransactionListResponseSchema: z.ZodObject<{
712
713
  address1?: string | undefined;
713
714
  } | undefined;
714
715
  loyaltyCardNumber?: string | undefined;
715
- name?: string | undefined;
716
716
  customerId?: string | undefined;
717
717
  nip?: string | undefined;
718
718
  } | undefined;
@@ -757,6 +757,7 @@ export declare const TransactionListResponseSchema: z.ZodObject<{
757
757
  createdAt?: string | undefined;
758
758
  customerId?: string | undefined;
759
759
  customerData?: {
760
+ name?: string | undefined;
760
761
  email?: string | undefined;
761
762
  phone?: string | undefined;
762
763
  address?: {
@@ -768,7 +769,6 @@ export declare const TransactionListResponseSchema: z.ZodObject<{
768
769
  address1?: string | undefined;
769
770
  } | undefined;
770
771
  loyaltyCardNumber?: string | undefined;
771
- name?: string | undefined;
772
772
  customerId?: string | undefined;
773
773
  nip?: string | undefined;
774
774
  } | undefined;
@@ -30,10 +30,10 @@ export const WalletTypeCreateResponseSchema = z.object({
30
30
  // INPUT SCHEMAS (for MCP tool definitions)
31
31
  // =============================================================================
32
32
  export const WalletTypeListInputSchema = {
33
- 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."),
33
+ storeCode: z.string().optional().describe("INTERNAL: Auto-configured from server settings. NEVER ask the user for this value. Only set if the user explicitly requests a different store."),
34
34
  };
35
35
  export const WalletTypeGetInputSchema = {
36
- 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."),
36
+ storeCode: z.string().optional().describe("INTERNAL: Auto-configured from server settings. NEVER ask the user for this value. Only set if the user explicitly requests a different store."),
37
37
  walletTypeId: z.string().describe("The wallet type ID (UUID) to retrieve."),
38
38
  };
39
39
  // Translations schema for wallet types
@@ -59,17 +59,19 @@ export const WalletTypeLimitsInputSchema = z.object({
59
59
  pointsPerMember: PointsLimitSchema.describe("Per-member points limit. Example: { interval: { type: 'calendarYears', value: 1 }, value: 10000 }"),
60
60
  }).optional();
61
61
  export const WalletTypeCreateInputSchema = {
62
- 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."),
62
+ storeCode: z.string().optional().describe("INTERNAL: Auto-configured from server settings. NEVER ask the user for this value. Only set if the user explicitly requests a different store."),
63
63
  translations: WalletTypeTranslationsInputSchema.describe("Translations with at least 'en' key containing { name }. REQUIRED."),
64
64
  unitSingularName: z.string().describe("Singular unit name (e.g., 'point', 'coin', 'star'). REQUIRED."),
65
65
  unitPluralName: z.string().describe("Plural unit name (e.g., 'points', 'coins', 'stars'). REQUIRED."),
66
- unitDaysExpiryAfter: z.string().describe("⚠️ REQUIRED. Days after earning before points expire. Use 'all_time_active' for never-expiring points, " +
67
- "or a number string like '365' for points that expire 365 days after earning."),
66
+ unitDaysExpiryAfter: z.string().describe("Days after earning before points expire. REQUIRED. " +
67
+ "BUSINESS DECISION: 'all_time_active' = points never expire (growing financial liability on balance sheet). " +
68
+ "'365' = standard 1-year expiry (controls liability). " +
69
+ "BUSINESS IMPACT: Never-expiring points accumulate as balance sheet liability."),
68
70
  code: z.string().optional().describe("Unique code for the wallet type (e.g., 'bonus_points', 'store_credit'). " +
69
71
  "Use lowercase with underscores. If not provided, a code will be auto-generated. " +
70
72
  "IMPORTANT: Cannot be changed after creation."),
71
73
  allowNegativeBalance: z.boolean().optional().describe("Whether to allow negative balances (default: false). " +
72
- "Set to true for credit-like systems where members can owe points."),
74
+ "BUSINESS DECISION: Allowing negative balances creates credit risk. Should never be defaulted to true."),
73
75
  unitExpiryDate: z.string().optional().describe("Annual expiry date in 'MM-DD' format (e.g., '12-31' for end of year). " +
74
76
  "Points earned during the year expire on this date. " +
75
77
  "IMPORTANT: Use 'MM-DD' format, NOT 'YYYY-MM-DD'."),
@@ -77,12 +79,12 @@ export const WalletTypeCreateInputSchema = {
77
79
  unitYearsActiveCount: z.number().int().nonnegative().optional().describe("Number of years points remain active after earning."),
78
80
  unitDaysLocked: z.number().int().nonnegative().optional().describe("Number of days points are PENDING (locked) after earning before becoming spendable. " +
79
81
  "Only used when allTimeNotLocked is false. Example: 7 for a 7-day pending period."),
80
- allTimeNotLocked: z.boolean().optional().describe(" PENDING METHOD: Set to TRUE for 'No pending' (points immediately available). " +
81
- "Set to FALSE (or omit) for 'Pending for X days' mode, then set unitDaysLocked to the number of days. " +
82
- "This maps to the 'Unit pending method' dropdown in the UI."),
82
+ allTimeNotLocked: z.boolean().optional().describe("BUSINESS DECISION: true = points immediately available (better member experience). " +
83
+ "false = pending period for fraud/return protection (set unitDaysLocked for duration). " +
84
+ "Typical values: true for low-risk programs, false + 14-day lock for high-value transactions."),
83
85
  };
84
86
  export const WalletTypeUpdateInputSchema = {
85
- 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."),
87
+ storeCode: z.string().optional().describe("INTERNAL: Auto-configured from server settings. NEVER ask the user for this value. Only set if the user explicitly requests a different store."),
86
88
  walletTypeId: z.string().describe("The wallet type ID (UUID) to update."),
87
89
  name: z.string().optional().describe("Update the wallet type name (updates translations.en.name)."),
88
90
  description: z.string().optional().describe("Update the description (updates translations.en.description)."),
@@ -29,20 +29,20 @@ export declare const WebhookSubscriptionSchema: z.ZodObject<{
29
29
  url: string;
30
30
  eventName: string;
31
31
  webhookSubscriptionId: string;
32
+ createdAt?: string | undefined;
32
33
  headers?: {
33
34
  headerName: string;
34
35
  headerValue: string;
35
36
  }[] | undefined;
36
- createdAt?: string | undefined;
37
37
  }, {
38
38
  url: string;
39
39
  eventName: string;
40
40
  webhookSubscriptionId: string;
41
+ createdAt?: string | undefined;
41
42
  headers?: {
42
43
  headerName: string;
43
44
  headerValue: string;
44
45
  }[] | undefined;
45
- createdAt?: string | undefined;
46
46
  }>;
47
47
  export type WebhookSubscription = z.infer<typeof WebhookSubscriptionSchema>;
48
48
  export declare const WebhookEventTypesSchema: z.ZodObject<{
@@ -73,20 +73,20 @@ export declare const WebhookSubscriptionListResponseSchema: z.ZodObject<{
73
73
  url: string;
74
74
  eventName: string;
75
75
  webhookSubscriptionId: string;
76
+ createdAt?: string | undefined;
76
77
  headers?: {
77
78
  headerName: string;
78
79
  headerValue: string;
79
80
  }[] | undefined;
80
- createdAt?: string | undefined;
81
81
  }, {
82
82
  url: string;
83
83
  eventName: string;
84
84
  webhookSubscriptionId: string;
85
+ createdAt?: string | undefined;
85
86
  headers?: {
86
87
  headerName: string;
87
88
  headerValue: string;
88
89
  }[] | undefined;
89
- createdAt?: string | undefined;
90
90
  }>, "many">;
91
91
  total: z.ZodOptional<z.ZodObject<{
92
92
  all: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
@@ -106,11 +106,11 @@ export declare const WebhookSubscriptionListResponseSchema: z.ZodObject<{
106
106
  url: string;
107
107
  eventName: string;
108
108
  webhookSubscriptionId: string;
109
+ createdAt?: string | undefined;
109
110
  headers?: {
110
111
  headerName: string;
111
112
  headerValue: string;
112
113
  }[] | undefined;
113
- createdAt?: string | undefined;
114
114
  }[];
115
115
  total?: {
116
116
  all?: string | number | undefined;
@@ -122,11 +122,11 @@ export declare const WebhookSubscriptionListResponseSchema: z.ZodObject<{
122
122
  url: string;
123
123
  eventName: string;
124
124
  webhookSubscriptionId: string;
125
+ createdAt?: string | undefined;
125
126
  headers?: {
126
127
  headerName: string;
127
128
  headerValue: string;
128
129
  }[] | undefined;
129
- createdAt?: string | undefined;
130
130
  }[];
131
131
  total?: {
132
132
  all?: string | number | undefined;
@@ -28,6 +28,22 @@ export function formatApiError(error, relatedTool) {
28
28
  relatedTool,
29
29
  });
30
30
  }
31
+ if (status === 401) {
32
+ return new OpenLoyaltyError({
33
+ code: "UNAUTHORIZED",
34
+ message: "Authentication failed or token expired",
35
+ hint: "The API token may be invalid or expired. Check the OL_API_TOKEN environment variable. If using OAuth, the token may need to be refreshed.",
36
+ relatedTool,
37
+ });
38
+ }
39
+ if (status === 403) {
40
+ return new OpenLoyaltyError({
41
+ code: "PERMISSION_DENIED",
42
+ message: "You don't have permission for this operation",
43
+ hint: "The current admin user lacks the required permission. Use ol_admin_get_permissions() to check available permissions, or contact an admin with higher privileges.",
44
+ relatedTool,
45
+ });
46
+ }
31
47
  if (status === 400) {
32
48
  const errors = data?.errors;
33
49
  const errorDetails = errors?.map(e => `${e.path || ''}: ${e.message}`).join('; ') || '';
@@ -72,6 +88,30 @@ export function formatApiError(error, relatedTool) {
72
88
  relatedTool,
73
89
  });
74
90
  }
91
+ if (status === 409) {
92
+ return new OpenLoyaltyError({
93
+ code: "CONFLICT",
94
+ message: data?.message ? String(data.message) : "Resource conflict - the resource may already exist or be in use",
95
+ hint: "A resource with this identifier already exists, or the resource is in a conflicting state. Try listing existing resources first.",
96
+ relatedTool,
97
+ });
98
+ }
99
+ if (status === 429) {
100
+ return new OpenLoyaltyError({
101
+ code: "RATE_LIMITED",
102
+ message: "Too many requests - rate limit exceeded",
103
+ hint: "Wait a few seconds and retry the request. If doing bulk operations, add delays between requests.",
104
+ relatedTool,
105
+ });
106
+ }
107
+ if (status && status >= 500) {
108
+ return new OpenLoyaltyError({
109
+ code: "SERVER_ERROR",
110
+ message: `API server error (HTTP ${status})`,
111
+ hint: "This is a server-side error, not a problem with your request. Wait a moment and retry. If the error persists, the API may be experiencing downtime.",
112
+ relatedTool,
113
+ });
114
+ }
75
115
  return new OpenLoyaltyError({
76
116
  code: `HTTP_${status || "UNKNOWN"}`,
77
117
  message: error.message,