@open-loyalty/mcp-server 1.0.3 → 1.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/README.md +180 -177
- package/dist/auth/provider.js +2 -14
- package/dist/auth/storage.js +22 -0
- package/dist/client/http.d.ts +5 -0
- package/dist/client/http.js +62 -3
- package/dist/config.d.ts +6 -5
- package/dist/config.js +15 -11
- package/dist/http.js +170 -65
- package/dist/instructions.d.ts +5 -0
- package/dist/instructions.js +420 -0
- package/dist/prompts/fan-engagement-setup.d.ts +107 -0
- package/dist/prompts/fan-engagement-setup.js +492 -0
- package/dist/server.d.ts +1 -1
- package/dist/server.js +68 -278
- package/dist/tools/achievement/handlers.d.ts +117 -0
- package/dist/tools/achievement/handlers.js +161 -0
- package/dist/tools/achievement/index.d.ts +479 -0
- package/dist/tools/achievement/index.js +74 -0
- package/dist/tools/achievement/schemas.d.ts +433 -0
- package/dist/tools/achievement/schemas.js +142 -0
- package/dist/tools/achievement.d.ts +155 -121
- package/dist/tools/achievement.js +82 -39
- package/dist/tools/admin.d.ts +18 -6
- package/dist/tools/admin.js +24 -12
- package/dist/tools/analytics.d.ts +29 -11
- package/dist/tools/analytics.js +58 -48
- package/dist/tools/apikey.d.ts +10 -3
- package/dist/tools/apikey.js +13 -6
- package/dist/tools/audit.d.ts +6 -2
- package/dist/tools/audit.js +8 -4
- package/dist/tools/badge.d.ts +14 -6
- package/dist/tools/badge.js +36 -27
- package/dist/tools/campaign/handlers.d.ts +42 -0
- package/dist/tools/campaign/handlers.js +223 -0
- package/dist/tools/campaign/index.d.ts +783 -0
- package/dist/tools/campaign/index.js +112 -0
- package/dist/tools/campaign/member-handlers.d.ts +60 -0
- package/dist/tools/campaign/member-handlers.js +159 -0
- package/dist/tools/campaign/schemas.d.ts +704 -0
- package/dist/tools/campaign/schemas.js +259 -0
- package/dist/tools/campaign/types.d.ts +161 -0
- package/dist/tools/campaign/types.js +2 -0
- package/dist/tools/campaign.d.ts +41 -16
- package/dist/tools/campaign.js +38 -25
- package/dist/tools/custom-event.d.ts +315 -0
- package/dist/tools/custom-event.js +270 -0
- package/dist/tools/export.d.ts +12 -4
- package/dist/tools/export.js +25 -20
- package/dist/tools/import.d.ts +9 -3
- package/dist/tools/import.js +33 -21
- package/dist/tools/index.d.ts +3 -11
- package/dist/tools/index.js +17 -475
- package/dist/tools/member/handlers.d.ts +111 -0
- package/dist/tools/member/handlers.js +206 -0
- package/dist/tools/member/index.d.ts +169 -0
- package/dist/tools/member/index.js +92 -0
- package/dist/tools/member/schemas.d.ts +89 -0
- package/dist/tools/member/schemas.js +65 -0
- package/dist/tools/member.d.ts +21 -0
- package/dist/tools/member.js +56 -62
- package/dist/tools/points.d.ts +19 -6
- package/dist/tools/points.js +51 -49
- package/dist/tools/referral/handlers.d.ts +47 -0
- package/dist/tools/referral/handlers.js +115 -0
- package/dist/tools/referral/index.d.ts +44 -0
- package/dist/tools/referral/index.js +44 -0
- package/dist/tools/referral/schemas.d.ts +34 -0
- package/dist/tools/referral/schemas.js +52 -0
- package/dist/tools/reward/handlers.d.ts +110 -0
- package/dist/tools/reward/handlers.js +289 -0
- package/dist/tools/reward/index.d.ts +177 -0
- package/dist/tools/reward/index.js +90 -0
- package/dist/tools/reward/schemas.d.ts +116 -0
- package/dist/tools/reward/schemas.js +91 -0
- package/dist/tools/reward.d.ts +18 -0
- package/dist/tools/reward.js +56 -66
- package/dist/tools/role.d.ts +26 -7
- package/dist/tools/role.js +25 -12
- package/dist/tools/segment/handlers.d.ts +87 -0
- package/dist/tools/segment/handlers.js +174 -0
- package/dist/tools/segment/index.d.ts +395 -0
- package/dist/tools/segment/index.js +87 -0
- package/dist/tools/segment/schemas.d.ts +337 -0
- package/dist/tools/segment/schemas.js +79 -0
- package/dist/tools/segment.d.ts +29 -10
- package/dist/tools/segment.js +84 -50
- package/dist/tools/store.d.ts +12 -4
- package/dist/tools/store.js +16 -8
- package/dist/tools/tierset.d.ts +19 -7
- package/dist/tools/tierset.js +44 -35
- package/dist/tools/transaction.d.ts +16 -8
- package/dist/tools/transaction.js +25 -21
- package/dist/tools/wallet-type.d.ts +7 -3
- package/dist/tools/wallet-type.js +14 -12
- package/dist/tools/webhook.d.ts +23 -10
- package/dist/tools/webhook.js +135 -33
- package/dist/types/schemas/achievement.d.ts +12 -309
- package/dist/types/schemas/achievement.js +0 -13
- package/dist/types/schemas/admin.d.ts +10 -97
- package/dist/types/schemas/admin.js +0 -38
- package/dist/types/schemas/badge.d.ts +0 -37
- package/dist/types/schemas/badge.js +0 -11
- package/dist/types/schemas/campaign.d.ts +64 -832
- package/dist/types/schemas/campaign.js +2 -25
- package/dist/types/schemas/common.d.ts +5 -0
- package/dist/types/schemas/common.js +5 -0
- package/dist/types/schemas/export.d.ts +0 -17
- package/dist/types/schemas/export.js +0 -7
- package/dist/types/schemas/member.d.ts +37 -176
- package/dist/types/schemas/member.js +0 -27
- package/dist/types/schemas/points.d.ts +0 -63
- package/dist/types/schemas/points.js +0 -22
- package/dist/types/schemas/reward.d.ts +71 -68
- package/dist/types/schemas/reward.js +8 -28
- package/dist/types/schemas/role.d.ts +0 -100
- package/dist/types/schemas/role.js +0 -29
- package/dist/types/schemas/segment.d.ts +0 -58
- package/dist/types/schemas/segment.js +0 -17
- package/dist/types/schemas/tierset.d.ts +0 -176
- package/dist/types/schemas/tierset.js +0 -27
- package/dist/types/schemas/transaction.d.ts +23 -254
- package/dist/types/schemas/transaction.js +0 -7
- package/dist/types/schemas/wallet-type.d.ts +8 -8
- package/dist/types/schemas/wallet-type.js +1 -1
- package/dist/types/schemas/webhook.d.ts +0 -58
- package/dist/types/schemas/webhook.js +0 -12
- package/dist/utils/errors.js +30 -3
- package/dist/utils/payload.d.ts +12 -0
- package/dist/utils/payload.js +14 -0
- package/dist/workflows/app-login-streak.d.ts +39 -0
- package/dist/workflows/app-login-streak.js +298 -0
- package/dist/workflows/early-arrival.d.ts +33 -0
- package/dist/workflows/early-arrival.js +148 -0
- package/dist/workflows/index.d.ts +101 -0
- package/dist/workflows/index.js +208 -0
- package/dist/workflows/match-attendance.d.ts +45 -0
- package/dist/workflows/match-attendance.js +308 -0
- package/dist/workflows/sportsbar-visit.d.ts +41 -0
- package/dist/workflows/sportsbar-visit.js +284 -0
- package/dist/workflows/vod-watching.d.ts +43 -0
- package/dist/workflows/vod-watching.js +326 -0
- package/package.json +10 -2
package/dist/tools/segment.js
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { apiGet, apiPost, apiPut, apiDelete } from "../client/http.js";
|
|
3
3
|
import { formatApiError } from "../utils/errors.js";
|
|
4
|
-
import {
|
|
4
|
+
import { getStoreCode } from "../config.js";
|
|
5
5
|
// Input Schemas
|
|
6
6
|
export const SegmentListInputSchema = {
|
|
7
|
-
storeCode: z.string().optional().describe("Store code.
|
|
7
|
+
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."),
|
|
8
8
|
page: z.number().optional().describe("Page number (default: 1)."),
|
|
9
9
|
perPage: z.number().optional().describe("Items per page (default: 10)."),
|
|
10
10
|
active: z.boolean().optional().describe("Filter by active status."),
|
|
11
11
|
name: z.string().optional().describe("Filter by segment name."),
|
|
12
12
|
};
|
|
13
13
|
// Criterion input schema - flexible to support all criterion types
|
|
14
|
+
// NOTE: Only certain criterion types are supported by the API.
|
|
15
|
+
// WORKING: transaction_count (requires both min AND max; MCP will auto-fill max if omitted)
|
|
16
|
+
// NOT WORKING: tier, points_balance (rejected by API despite being documented)
|
|
14
17
|
const SegmentCriterionInputSchema = z.object({
|
|
15
|
-
type: z.string().describe("Criterion type (
|
|
18
|
+
type: z.string().describe("Criterion type. WORKING: 'transaction_count' (requires both min AND max; MCP auto-fills max if omitted). NOT WORKING: 'tier', 'points_balance' are rejected by the API."),
|
|
16
19
|
criterionId: z.string().optional().describe("Criterion ID (optional, generated if not provided)."),
|
|
17
20
|
// Common criterion data fields
|
|
18
21
|
days: z.number().optional().describe("Days for time-based criteria."),
|
|
@@ -37,18 +40,18 @@ const SegmentPartInputSchema = z.object({
|
|
|
37
40
|
criteria: z.array(SegmentCriterionInputSchema).describe("Criteria for this part (AND logic)."),
|
|
38
41
|
});
|
|
39
42
|
export const SegmentCreateInputSchema = {
|
|
40
|
-
storeCode: z.string().optional().describe("Store code.
|
|
43
|
+
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."),
|
|
41
44
|
name: z.string().describe("Segment name (required)."),
|
|
42
45
|
description: z.string().optional().describe("Segment description."),
|
|
43
46
|
active: z.boolean().optional().describe("Whether segment is active (default: false)."),
|
|
44
47
|
parts: z.array(SegmentPartInputSchema).describe("Segment parts. Parts use OR logic (ANY part matches), criteria within parts use AND logic (ALL criteria must match)."),
|
|
45
48
|
};
|
|
46
49
|
export const SegmentGetInputSchema = {
|
|
47
|
-
storeCode: z.string().optional().describe("Store code.
|
|
50
|
+
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."),
|
|
48
51
|
segmentId: z.string().describe("The segment ID (UUID) to retrieve."),
|
|
49
52
|
};
|
|
50
53
|
export const SegmentUpdateInputSchema = {
|
|
51
|
-
storeCode: z.string().optional().describe("Store code.
|
|
54
|
+
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."),
|
|
52
55
|
segmentId: z.string().describe("The segment ID (UUID) to update."),
|
|
53
56
|
name: z.string().describe("Segment name."),
|
|
54
57
|
description: z.string().optional().describe("Segment description."),
|
|
@@ -56,31 +59,30 @@ export const SegmentUpdateInputSchema = {
|
|
|
56
59
|
parts: z.array(SegmentPartInputSchema).describe("Segment parts."),
|
|
57
60
|
};
|
|
58
61
|
export const SegmentDeleteInputSchema = {
|
|
59
|
-
storeCode: z.string().optional().describe("Store code.
|
|
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."),
|
|
60
63
|
segmentId: z.string().describe("The segment ID (UUID) to delete."),
|
|
61
64
|
};
|
|
62
65
|
export const SegmentGetMembersInputSchema = {
|
|
63
|
-
storeCode: z.string().optional().describe("Store code.
|
|
66
|
+
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."),
|
|
64
67
|
segmentId: z.string().describe("The segment ID (UUID) to get members for."),
|
|
65
68
|
page: z.number().optional().describe("Page number (default: 1)."),
|
|
66
69
|
perPage: z.number().optional().describe("Items per page (default: 25)."),
|
|
67
70
|
};
|
|
68
71
|
export const SegmentActivateInputSchema = {
|
|
69
|
-
storeCode: z.string().optional().describe("Store code.
|
|
72
|
+
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."),
|
|
70
73
|
segmentId: z.string().describe("The segment ID (UUID) to activate."),
|
|
71
74
|
};
|
|
72
75
|
export const SegmentDeactivateInputSchema = {
|
|
73
|
-
storeCode: z.string().optional().describe("Store code.
|
|
76
|
+
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."),
|
|
74
77
|
segmentId: z.string().describe("The segment ID (UUID) to deactivate."),
|
|
75
78
|
};
|
|
76
79
|
export const SegmentGetResourcesInputSchema = {
|
|
77
|
-
storeCode: z.string().optional().describe("Store code.
|
|
80
|
+
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."),
|
|
78
81
|
segmentId: z.string().describe("The segment ID (UUID) to get associated resources for."),
|
|
79
82
|
};
|
|
80
83
|
// Handler functions
|
|
81
84
|
export async function segmentList(input) {
|
|
82
|
-
const
|
|
83
|
-
const storeCode = input.storeCode || config.defaultStoreCode;
|
|
85
|
+
const storeCode = getStoreCode(input.storeCode);
|
|
84
86
|
const params = new URLSearchParams();
|
|
85
87
|
if (input.page)
|
|
86
88
|
params.append("_page", String(input.page));
|
|
@@ -112,15 +114,32 @@ export async function segmentList(input) {
|
|
|
112
114
|
};
|
|
113
115
|
}
|
|
114
116
|
catch (error) {
|
|
115
|
-
throw formatApiError(error, "
|
|
117
|
+
throw formatApiError(error, "ol_segment_list");
|
|
116
118
|
}
|
|
117
119
|
}
|
|
120
|
+
const DEFAULT_TRANSACTION_COUNT_MAX = 999999;
|
|
121
|
+
function normalizeSegmentParts(parts) {
|
|
122
|
+
return parts.map((part) => ({
|
|
123
|
+
...part,
|
|
124
|
+
criteria: part.criteria.map((criterion) => {
|
|
125
|
+
if (!criterion || typeof criterion !== "object") {
|
|
126
|
+
return criterion;
|
|
127
|
+
}
|
|
128
|
+
const normalized = { ...criterion };
|
|
129
|
+
if (normalized.type === "transaction_count" &&
|
|
130
|
+
normalized.min !== undefined &&
|
|
131
|
+
normalized.max === undefined) {
|
|
132
|
+
normalized.max = DEFAULT_TRANSACTION_COUNT_MAX;
|
|
133
|
+
}
|
|
134
|
+
return normalized;
|
|
135
|
+
}),
|
|
136
|
+
}));
|
|
137
|
+
}
|
|
118
138
|
export async function segmentCreate(input) {
|
|
119
|
-
const
|
|
120
|
-
const storeCode = input.storeCode || config.defaultStoreCode;
|
|
139
|
+
const storeCode = getStoreCode(input.storeCode);
|
|
121
140
|
const segmentPayload = {
|
|
122
141
|
name: input.name,
|
|
123
|
-
parts: input.parts,
|
|
142
|
+
parts: normalizeSegmentParts(input.parts),
|
|
124
143
|
};
|
|
125
144
|
if (input.description)
|
|
126
145
|
segmentPayload.description = input.description;
|
|
@@ -132,26 +151,24 @@ export async function segmentCreate(input) {
|
|
|
132
151
|
return { segmentId: response.segmentId };
|
|
133
152
|
}
|
|
134
153
|
catch (error) {
|
|
135
|
-
throw formatApiError(error, "
|
|
154
|
+
throw formatApiError(error, "ol_segment_create");
|
|
136
155
|
}
|
|
137
156
|
}
|
|
138
157
|
export async function segmentGet(input) {
|
|
139
|
-
const
|
|
140
|
-
const storeCode = input.storeCode || config.defaultStoreCode;
|
|
158
|
+
const storeCode = getStoreCode(input.storeCode);
|
|
141
159
|
try {
|
|
142
160
|
const response = await apiGet(`/${storeCode}/segment/${input.segmentId}`);
|
|
143
161
|
return response;
|
|
144
162
|
}
|
|
145
163
|
catch (error) {
|
|
146
|
-
throw formatApiError(error, "
|
|
164
|
+
throw formatApiError(error, "ol_segment_get");
|
|
147
165
|
}
|
|
148
166
|
}
|
|
149
167
|
export async function segmentUpdate(input) {
|
|
150
|
-
const
|
|
151
|
-
const storeCode = input.storeCode || config.defaultStoreCode;
|
|
168
|
+
const storeCode = getStoreCode(input.storeCode);
|
|
152
169
|
const segmentPayload = {
|
|
153
170
|
name: input.name,
|
|
154
|
-
parts: input.parts,
|
|
171
|
+
parts: normalizeSegmentParts(input.parts),
|
|
155
172
|
};
|
|
156
173
|
if (input.description !== undefined)
|
|
157
174
|
segmentPayload.description = input.description;
|
|
@@ -162,22 +179,20 @@ export async function segmentUpdate(input) {
|
|
|
162
179
|
await apiPut(`/${storeCode}/segment/${input.segmentId}`, { segment: segmentPayload });
|
|
163
180
|
}
|
|
164
181
|
catch (error) {
|
|
165
|
-
throw formatApiError(error, "
|
|
182
|
+
throw formatApiError(error, "ol_segment_update");
|
|
166
183
|
}
|
|
167
184
|
}
|
|
168
185
|
export async function segmentDelete(input) {
|
|
169
|
-
const
|
|
170
|
-
const storeCode = input.storeCode || config.defaultStoreCode;
|
|
186
|
+
const storeCode = getStoreCode(input.storeCode);
|
|
171
187
|
try {
|
|
172
188
|
await apiDelete(`/${storeCode}/segment/${input.segmentId}`);
|
|
173
189
|
}
|
|
174
190
|
catch (error) {
|
|
175
|
-
throw formatApiError(error, "
|
|
191
|
+
throw formatApiError(error, "ol_segment_delete");
|
|
176
192
|
}
|
|
177
193
|
}
|
|
178
194
|
export async function segmentGetMembers(input) {
|
|
179
|
-
const
|
|
180
|
-
const storeCode = input.storeCode || config.defaultStoreCode;
|
|
195
|
+
const storeCode = getStoreCode(input.storeCode);
|
|
181
196
|
const params = new URLSearchParams();
|
|
182
197
|
if (input.page)
|
|
183
198
|
params.append("_page", String(input.page));
|
|
@@ -205,94 +220,113 @@ export async function segmentGetMembers(input) {
|
|
|
205
220
|
};
|
|
206
221
|
}
|
|
207
222
|
catch (error) {
|
|
208
|
-
throw formatApiError(error, "
|
|
223
|
+
throw formatApiError(error, "ol_segment_get_members");
|
|
209
224
|
}
|
|
210
225
|
}
|
|
211
226
|
export async function segmentActivate(input) {
|
|
212
|
-
const
|
|
213
|
-
const storeCode = input.storeCode || config.defaultStoreCode;
|
|
227
|
+
const storeCode = getStoreCode(input.storeCode);
|
|
214
228
|
try {
|
|
215
229
|
await apiPost(`/${storeCode}/segment/${input.segmentId}/activate`, {});
|
|
216
230
|
}
|
|
217
231
|
catch (error) {
|
|
218
|
-
throw formatApiError(error, "
|
|
232
|
+
throw formatApiError(error, "ol_segment_activate");
|
|
219
233
|
}
|
|
220
234
|
}
|
|
221
235
|
export async function segmentDeactivate(input) {
|
|
222
|
-
const
|
|
223
|
-
const storeCode = input.storeCode || config.defaultStoreCode;
|
|
236
|
+
const storeCode = getStoreCode(input.storeCode);
|
|
224
237
|
try {
|
|
225
238
|
await apiPost(`/${storeCode}/segment/${input.segmentId}/deactivate`, {});
|
|
226
239
|
}
|
|
227
240
|
catch (error) {
|
|
228
|
-
throw formatApiError(error, "
|
|
241
|
+
throw formatApiError(error, "ol_segment_deactivate");
|
|
229
242
|
}
|
|
230
243
|
}
|
|
231
244
|
export async function segmentGetResources(input) {
|
|
232
|
-
const
|
|
233
|
-
const storeCode = input.storeCode || config.defaultStoreCode;
|
|
245
|
+
const storeCode = getStoreCode(input.storeCode);
|
|
234
246
|
try {
|
|
235
247
|
const response = await apiGet(`/${storeCode}/segment/${input.segmentId}/resources`);
|
|
236
248
|
const resources = response.items || response.resources || [];
|
|
237
249
|
return { resources };
|
|
238
250
|
}
|
|
239
251
|
catch (error) {
|
|
240
|
-
throw formatApiError(error, "
|
|
252
|
+
throw formatApiError(error, "ol_segment_get_resources");
|
|
241
253
|
}
|
|
242
254
|
}
|
|
243
255
|
// Tool definitions
|
|
244
256
|
export const segmentToolDefinitions = [
|
|
245
257
|
{
|
|
246
|
-
name: "
|
|
258
|
+
name: "ol_segment_list",
|
|
259
|
+
title: "List Segments",
|
|
247
260
|
description: "List customer segments. Segments group members by criteria (purchase behavior, tier, location, etc). Use for campaign targeting and analytics.",
|
|
261
|
+
readOnly: true,
|
|
248
262
|
inputSchema: SegmentListInputSchema,
|
|
249
263
|
handler: segmentList,
|
|
250
264
|
},
|
|
251
265
|
{
|
|
252
|
-
name: "
|
|
253
|
-
|
|
266
|
+
name: "ol_segment_create",
|
|
267
|
+
title: "Create Segment",
|
|
268
|
+
description: "Create segment to group members. Parts use OR logic (member matches if ANY part matches). Criteria within parts use AND logic (must match ALL criteria in that part). " +
|
|
269
|
+
"WORKING criterion types: 'transaction_count' (requires BOTH min AND max). " +
|
|
270
|
+
"NOT WORKING: 'tier', 'points_balance' are rejected by the API. " +
|
|
271
|
+
"Example - High activity segment: parts: [{ criteria: [{ type: 'transaction_count', min: 5, max: 999999 }] }]",
|
|
272
|
+
readOnly: false,
|
|
254
273
|
inputSchema: SegmentCreateInputSchema,
|
|
255
274
|
handler: segmentCreate,
|
|
256
275
|
},
|
|
257
276
|
{
|
|
258
|
-
name: "
|
|
277
|
+
name: "ol_segment_get",
|
|
278
|
+
title: "Get Segment Details",
|
|
259
279
|
description: "Get full segment details including all parts and criteria configurations.",
|
|
280
|
+
readOnly: true,
|
|
260
281
|
inputSchema: SegmentGetInputSchema,
|
|
261
282
|
handler: segmentGet,
|
|
262
283
|
},
|
|
263
284
|
{
|
|
264
|
-
name: "
|
|
285
|
+
name: "ol_segment_update",
|
|
286
|
+
title: "Update Segment",
|
|
265
287
|
description: "Update segment configuration. Requires full segment definition (name, parts with criteria). Use segment_get first to retrieve current configuration.",
|
|
288
|
+
readOnly: false,
|
|
266
289
|
inputSchema: SegmentUpdateInputSchema,
|
|
267
290
|
handler: segmentUpdate,
|
|
268
291
|
},
|
|
269
292
|
{
|
|
270
|
-
name: "
|
|
293
|
+
name: "ol_segment_delete",
|
|
294
|
+
title: "Delete Segment (Permanent)",
|
|
271
295
|
description: "Permanently delete a segment. Cannot be undone. Check segment_get_resources first to see what uses this segment.",
|
|
296
|
+
readOnly: false,
|
|
297
|
+
destructive: true,
|
|
272
298
|
inputSchema: SegmentDeleteInputSchema,
|
|
273
299
|
handler: segmentDelete,
|
|
274
300
|
},
|
|
275
301
|
{
|
|
276
|
-
name: "
|
|
302
|
+
name: "ol_segment_get_members",
|
|
303
|
+
title: "Get Segment Members",
|
|
277
304
|
description: "Get members belonging to a segment. Returns paginated list of member details. Use for verifying segment criteria or exporting member lists.",
|
|
305
|
+
readOnly: true,
|
|
278
306
|
inputSchema: SegmentGetMembersInputSchema,
|
|
279
307
|
handler: segmentGetMembers,
|
|
280
308
|
},
|
|
281
309
|
{
|
|
282
|
-
name: "
|
|
310
|
+
name: "ol_segment_activate",
|
|
311
|
+
title: "Activate Segment",
|
|
283
312
|
description: "Activate a segment. Active segments are used for campaign targeting and can be queried for members.",
|
|
313
|
+
readOnly: false,
|
|
284
314
|
inputSchema: SegmentActivateInputSchema,
|
|
285
315
|
handler: segmentActivate,
|
|
286
316
|
},
|
|
287
317
|
{
|
|
288
|
-
name: "
|
|
318
|
+
name: "ol_segment_deactivate",
|
|
319
|
+
title: "Deactivate Segment",
|
|
289
320
|
description: "Deactivate a segment. Deactivated segments are not used for campaign targeting but retain their configuration.",
|
|
321
|
+
readOnly: false,
|
|
290
322
|
inputSchema: SegmentDeactivateInputSchema,
|
|
291
323
|
handler: segmentDeactivate,
|
|
292
324
|
},
|
|
293
325
|
{
|
|
294
|
-
name: "
|
|
326
|
+
name: "ol_segment_get_resources",
|
|
327
|
+
title: "Get Segment Resources",
|
|
295
328
|
description: "Get resources (campaigns, rewards, etc.) that use this segment for targeting. Check before deleting a segment.",
|
|
329
|
+
readOnly: true,
|
|
296
330
|
inputSchema: SegmentGetResourcesInputSchema,
|
|
297
331
|
handler: segmentGetResources,
|
|
298
332
|
},
|
package/dist/tools/store.d.ts
CHANGED
|
@@ -61,8 +61,10 @@ export declare function storeUpdate(input: {
|
|
|
61
61
|
currency?: string;
|
|
62
62
|
}): Promise<void>;
|
|
63
63
|
export declare const storeToolDefinitions: readonly [{
|
|
64
|
-
readonly name: "
|
|
64
|
+
readonly name: "ol_store_list";
|
|
65
|
+
readonly title: "List Stores";
|
|
65
66
|
readonly description: "List all stores with optional filtering. Returns paginated list of stores with storeId, code, name, currency, and active status. Stores enable multi-tenant loyalty programs. Each store has independent members, campaigns, and settings.";
|
|
67
|
+
readonly readOnly: true;
|
|
66
68
|
readonly inputSchema: {
|
|
67
69
|
page: z.ZodOptional<z.ZodNumber>;
|
|
68
70
|
perPage: z.ZodOptional<z.ZodNumber>;
|
|
@@ -72,8 +74,10 @@ export declare const storeToolDefinitions: readonly [{
|
|
|
72
74
|
};
|
|
73
75
|
readonly handler: typeof storeList;
|
|
74
76
|
}, {
|
|
75
|
-
readonly name: "
|
|
77
|
+
readonly name: "ol_store_create";
|
|
78
|
+
readonly title: "Create Store";
|
|
76
79
|
readonly description: "Create a new store for multi-tenant setup. Requires unique code and name. Returns storeId on success.";
|
|
80
|
+
readonly readOnly: false;
|
|
77
81
|
readonly inputSchema: {
|
|
78
82
|
code: z.ZodString;
|
|
79
83
|
name: z.ZodString;
|
|
@@ -82,15 +86,19 @@ export declare const storeToolDefinitions: readonly [{
|
|
|
82
86
|
};
|
|
83
87
|
readonly handler: typeof storeCreate;
|
|
84
88
|
}, {
|
|
85
|
-
readonly name: "
|
|
89
|
+
readonly name: "ol_store_get";
|
|
90
|
+
readonly title: "Get Store Details";
|
|
86
91
|
readonly description: "Get full store configuration by ID. Returns storeId, code, name, currency, active status, and timestamps.";
|
|
92
|
+
readonly readOnly: true;
|
|
87
93
|
readonly inputSchema: {
|
|
88
94
|
storeId: z.ZodString;
|
|
89
95
|
};
|
|
90
96
|
readonly handler: typeof storeGet;
|
|
91
97
|
}, {
|
|
92
|
-
readonly name: "
|
|
98
|
+
readonly name: "ol_store_update";
|
|
99
|
+
readonly title: "Update Store";
|
|
93
100
|
readonly description: "Update store configuration. Can update name, currency, and active status. Returns void on success (204 No Content).";
|
|
101
|
+
readonly readOnly: false;
|
|
94
102
|
readonly inputSchema: {
|
|
95
103
|
storeId: z.ZodString;
|
|
96
104
|
name: z.ZodOptional<z.ZodString>;
|
package/dist/tools/store.js
CHANGED
|
@@ -44,7 +44,7 @@ export async function storeList(input) {
|
|
|
44
44
|
return response;
|
|
45
45
|
}
|
|
46
46
|
catch (error) {
|
|
47
|
-
throw formatApiError(error, "
|
|
47
|
+
throw formatApiError(error, "ol_store_list");
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
export async function storeCreate(input) {
|
|
@@ -61,7 +61,7 @@ export async function storeCreate(input) {
|
|
|
61
61
|
return response;
|
|
62
62
|
}
|
|
63
63
|
catch (error) {
|
|
64
|
-
throw formatApiError(error, "
|
|
64
|
+
throw formatApiError(error, "ol_store_create");
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
export async function storeGet(input) {
|
|
@@ -70,7 +70,7 @@ export async function storeGet(input) {
|
|
|
70
70
|
return response;
|
|
71
71
|
}
|
|
72
72
|
catch (error) {
|
|
73
|
-
throw formatApiError(error, "
|
|
73
|
+
throw formatApiError(error, "ol_store_get");
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
export async function storeUpdate(input) {
|
|
@@ -85,32 +85,40 @@ export async function storeUpdate(input) {
|
|
|
85
85
|
await apiPut(`/store/${input.storeId}`, { store: payload });
|
|
86
86
|
}
|
|
87
87
|
catch (error) {
|
|
88
|
-
throw formatApiError(error, "
|
|
88
|
+
throw formatApiError(error, "ol_store_update");
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
// Tool definitions
|
|
92
92
|
export const storeToolDefinitions = [
|
|
93
93
|
{
|
|
94
|
-
name: "
|
|
94
|
+
name: "ol_store_list",
|
|
95
|
+
title: "List Stores",
|
|
95
96
|
description: "List all stores with optional filtering. Returns paginated list of stores with storeId, code, name, currency, and active status. Stores enable multi-tenant loyalty programs. Each store has independent members, campaigns, and settings.",
|
|
97
|
+
readOnly: true,
|
|
96
98
|
inputSchema: StoreListInputSchema,
|
|
97
99
|
handler: storeList,
|
|
98
100
|
},
|
|
99
101
|
{
|
|
100
|
-
name: "
|
|
102
|
+
name: "ol_store_create",
|
|
103
|
+
title: "Create Store",
|
|
101
104
|
description: "Create a new store for multi-tenant setup. Requires unique code and name. Returns storeId on success.",
|
|
105
|
+
readOnly: false,
|
|
102
106
|
inputSchema: StoreCreateInputSchema,
|
|
103
107
|
handler: storeCreate,
|
|
104
108
|
},
|
|
105
109
|
{
|
|
106
|
-
name: "
|
|
110
|
+
name: "ol_store_get",
|
|
111
|
+
title: "Get Store Details",
|
|
107
112
|
description: "Get full store configuration by ID. Returns storeId, code, name, currency, active status, and timestamps.",
|
|
113
|
+
readOnly: true,
|
|
108
114
|
inputSchema: StoreGetInputSchema,
|
|
109
115
|
handler: storeGet,
|
|
110
116
|
},
|
|
111
117
|
{
|
|
112
|
-
name: "
|
|
118
|
+
name: "ol_store_update",
|
|
119
|
+
title: "Update Store",
|
|
113
120
|
description: "Update store configuration. Can update name, currency, and active status. Returns void on success (204 No Content).",
|
|
121
|
+
readOnly: false,
|
|
114
122
|
inputSchema: StoreUpdateInputSchema,
|
|
115
123
|
handler: storeUpdate,
|
|
116
124
|
},
|
package/dist/tools/tierset.d.ts
CHANGED
|
@@ -167,8 +167,10 @@ export declare function tiersetGetTiers(input: TierSetGetInput): Promise<{
|
|
|
167
167
|
};
|
|
168
168
|
}>;
|
|
169
169
|
export declare const tiersetToolDefinitions: readonly [{
|
|
170
|
-
readonly name: "
|
|
170
|
+
readonly name: "ol_tierset_list";
|
|
171
|
+
readonly title: "List Loyalty Programs";
|
|
171
172
|
readonly description: "List all tier sets. Use tierset_get to fetch conditions needed for defining tiers. Returns tierSetId, name, active status, and tier count for each tier set.";
|
|
173
|
+
readonly readOnly: true;
|
|
172
174
|
readonly inputSchema: {
|
|
173
175
|
storeCode: z.ZodOptional<z.ZodString>;
|
|
174
176
|
page: z.ZodOptional<z.ZodNumber>;
|
|
@@ -176,8 +178,10 @@ export declare const tiersetToolDefinitions: readonly [{
|
|
|
176
178
|
};
|
|
177
179
|
readonly handler: typeof tiersetList;
|
|
178
180
|
}, {
|
|
179
|
-
readonly name: "
|
|
180
|
-
readonly
|
|
181
|
+
readonly name: "ol_tierset_create";
|
|
182
|
+
readonly title: "Create Loyalty Program";
|
|
183
|
+
readonly description: string;
|
|
184
|
+
readonly readOnly: false;
|
|
181
185
|
readonly inputSchema: {
|
|
182
186
|
storeCode: z.ZodOptional<z.ZodString>;
|
|
183
187
|
name: z.ZodString;
|
|
@@ -206,16 +210,20 @@ export declare const tiersetToolDefinitions: readonly [{
|
|
|
206
210
|
};
|
|
207
211
|
readonly handler: typeof tiersetCreate;
|
|
208
212
|
}, {
|
|
209
|
-
readonly name: "
|
|
213
|
+
readonly name: "ol_tierset_get";
|
|
214
|
+
readonly title: "Get Loyalty Program Details";
|
|
210
215
|
readonly description: "Get tier set details including conditionId values needed for tierset_update_tiers. Returns the full tier set with conditions array containing conditionId for each condition.";
|
|
216
|
+
readonly readOnly: true;
|
|
211
217
|
readonly inputSchema: {
|
|
212
218
|
storeCode: z.ZodOptional<z.ZodString>;
|
|
213
219
|
tierSetId: z.ZodString;
|
|
214
220
|
};
|
|
215
221
|
readonly handler: typeof tiersetGet;
|
|
216
222
|
}, {
|
|
217
|
-
readonly name: "
|
|
223
|
+
readonly name: "ol_tierset_update";
|
|
224
|
+
readonly title: "Update Loyalty Program";
|
|
218
225
|
readonly description: "Update tier set metadata (name, description, active status, downgrade settings). Does not modify tiers - use tierset_update_tiers for that.";
|
|
226
|
+
readonly readOnly: false;
|
|
219
227
|
readonly inputSchema: {
|
|
220
228
|
storeCode: z.ZodOptional<z.ZodString>;
|
|
221
229
|
tierSetId: z.ZodString;
|
|
@@ -235,8 +243,10 @@ export declare const tiersetToolDefinitions: readonly [{
|
|
|
235
243
|
};
|
|
236
244
|
readonly handler: typeof tiersetUpdate;
|
|
237
245
|
}, {
|
|
238
|
-
readonly name: "
|
|
246
|
+
readonly name: "ol_tierset_update_tiers";
|
|
247
|
+
readonly title: "Configure Tier Thresholds";
|
|
239
248
|
readonly description: "Define tier thresholds for a tier set. PREREQUISITE: Call tierset_get first to obtain conditionId values. Each tier's conditions array uses conditionId from the parent tier set plus a threshold value.\n\nExample for a 3-tier program with points-based progression:\n- Bronze tier: conditions: [{ conditionId: \"xxx\", value: 400 }]\n- Silver tier: conditions: [{ conditionId: \"xxx\", value: 800 }]\n- Gold tier: conditions: [{ conditionId: \"xxx\", value: 1200 }]\n\nThe conditionId must match one from tierset_get response.";
|
|
249
|
+
readonly readOnly: false;
|
|
240
250
|
readonly inputSchema: {
|
|
241
251
|
storeCode: z.ZodOptional<z.ZodString>;
|
|
242
252
|
tierSetId: z.ZodString;
|
|
@@ -277,8 +287,10 @@ export declare const tiersetToolDefinitions: readonly [{
|
|
|
277
287
|
};
|
|
278
288
|
readonly handler: typeof tiersetUpdateTiers;
|
|
279
289
|
}, {
|
|
280
|
-
readonly name: "
|
|
290
|
+
readonly name: "ol_tierset_get_tiers";
|
|
291
|
+
readonly title: "Get Tier Configuration";
|
|
281
292
|
readonly description: "Get all tiers in a tier set. Returns levelId values that can be used for campaign targeting. Includes each tier's name and condition thresholds.";
|
|
293
|
+
readonly readOnly: true;
|
|
282
294
|
readonly inputSchema: {
|
|
283
295
|
storeCode: z.ZodOptional<z.ZodString>;
|
|
284
296
|
tierSetId: z.ZodString;
|