mcp-prqx-pricer 1.0.11 → 1.0.13
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 +3 -0
- package/build/index.js +16 -14
- package/build/tools/createPricingGroup.js +5 -3
- package/build/tools/deletePricingGroups.js +11 -11
- package/build/tools/updatePricingGroup.js +194 -0
- package/package.json +1 -1
- package/src/index.ts +74 -62
- package/src/tools/createPricingGroup.ts +5 -3
- package/src/tools/deletePricingGroups.ts +44 -30
- package/src/tools/updatePricingGroup.ts +255 -0
- package/src/types/pricingGroup.ts +14 -1
- package/openapi/pricer.json +0 -7208
@@ -0,0 +1,255 @@
|
|
1
|
+
import { McpTool } from "../types/tool";
|
2
|
+
import {
|
3
|
+
CallToolRequest,
|
4
|
+
ErrorCode,
|
5
|
+
McpError,
|
6
|
+
} from "@modelcontextprotocol/sdk/types.js";
|
7
|
+
import { AxiosInstance } from "axios";
|
8
|
+
import {
|
9
|
+
CeilingPricingMethod,
|
10
|
+
CustomSharingMethod,
|
11
|
+
FloorPricingMethod,
|
12
|
+
NoCompPricingMethod,
|
13
|
+
PricingGroupRequestType,
|
14
|
+
PricingGroupResponse,
|
15
|
+
PricingGroupUpdateRequest,
|
16
|
+
ShareOptionsType,
|
17
|
+
} from "../types/pricingGroup";
|
18
|
+
|
19
|
+
export class UpdatePricingGroupTool implements McpTool {
|
20
|
+
name = "UpdatePricingGroup";
|
21
|
+
description =
|
22
|
+
"Allows to update any individual property of an existing pricing group";
|
23
|
+
inputSchema = {
|
24
|
+
type: "object",
|
25
|
+
properties: {
|
26
|
+
pricingGroupId: {
|
27
|
+
type: "number",
|
28
|
+
description: "ID of the pricing group to modify",
|
29
|
+
},
|
30
|
+
name: {
|
31
|
+
type: "string",
|
32
|
+
description: "Name of the pricing group",
|
33
|
+
},
|
34
|
+
ceilingPrice: {
|
35
|
+
type: "number",
|
36
|
+
description: "Maximum price that the pricing group tickets can have",
|
37
|
+
},
|
38
|
+
floorPrice: {
|
39
|
+
type: "number",
|
40
|
+
description: "Minimum price that the pricing group tickets can have",
|
41
|
+
},
|
42
|
+
pricingGroupMode: {
|
43
|
+
type: "string",
|
44
|
+
description: "(AutoPrice or SimulationOnly) Mode of the pricing group",
|
45
|
+
},
|
46
|
+
amount: {
|
47
|
+
type: "number",
|
48
|
+
description:
|
49
|
+
"Amount used to price the anchor ticket of the pricing group based on the first market comparable",
|
50
|
+
},
|
51
|
+
increment: {
|
52
|
+
type: "string",
|
53
|
+
description:
|
54
|
+
"(increase or decrease) Decides if the amount is applied to increase or decrease the price of the anchor ticket of the pricing group based on the first market comparable",
|
55
|
+
},
|
56
|
+
incrementMethod: {
|
57
|
+
type: "string",
|
58
|
+
description:
|
59
|
+
"( % or $ ) Decides if the amount is applied as a percentage or a dollar amount",
|
60
|
+
},
|
61
|
+
offsetAmount: {
|
62
|
+
type: "number",
|
63
|
+
description:
|
64
|
+
"Offset amount used to price the other tickets in the group based of the previously ranked ticket",
|
65
|
+
},
|
66
|
+
offsetIncrement: {
|
67
|
+
type: "string",
|
68
|
+
description:
|
69
|
+
"(increase or decrease) Decides if the offset amount is applied to increase or decrease the price of the other tickets in the group based of the previously ranked ticket",
|
70
|
+
},
|
71
|
+
offsetIncrementMethod: {
|
72
|
+
type: "string",
|
73
|
+
description:
|
74
|
+
"( % or $ ) Decides if the offset amount is applied as a percentage or a dollar amount",
|
75
|
+
},
|
76
|
+
enableShareOptions: {
|
77
|
+
type: "boolean",
|
78
|
+
description:
|
79
|
+
"Decides if the pricing group will control the sharing of tickets in a marketplace or not",
|
80
|
+
},
|
81
|
+
shareOptionsType: {
|
82
|
+
type: "string",
|
83
|
+
description:
|
84
|
+
"(all or custom) Decides if we use custom parameters to share the tickets in the group or if we share them all. Default all.",
|
85
|
+
},
|
86
|
+
shareAnchor: {
|
87
|
+
type: "boolean",
|
88
|
+
description:
|
89
|
+
"Controls if the anchor ticket of the pricing group will be shared or not",
|
90
|
+
},
|
91
|
+
customSharingAmount: {
|
92
|
+
type: "number",
|
93
|
+
description:
|
94
|
+
"Custom sharing amount use to determine which tickets to share of this pricing group",
|
95
|
+
},
|
96
|
+
customSharingMethod: {
|
97
|
+
type: "string",
|
98
|
+
description:
|
99
|
+
"( $ or % ) Decides if the custom sharing amount is applied as a percentage or a dollar amount.",
|
100
|
+
},
|
101
|
+
applyCeilingOnlyToAnchor: {
|
102
|
+
type: "boolean",
|
103
|
+
description:
|
104
|
+
"Decides if the ceiling price will be applied only to the anchor ticket of the pricing group",
|
105
|
+
},
|
106
|
+
applyFloorOnlyToAnchor: {
|
107
|
+
type: "boolean",
|
108
|
+
description:
|
109
|
+
"Decides if the floor price will be applied only to the anchor ticket of the pricing group",
|
110
|
+
},
|
111
|
+
floorPricingMethod: {
|
112
|
+
type: "string",
|
113
|
+
description:
|
114
|
+
"(standard, variable, useFloor or floorRandomize) Decides what method to apply for pricing when the market comparable for the pricing group hits the floor price",
|
115
|
+
},
|
116
|
+
ceilingPricingMethod: {
|
117
|
+
type: "string",
|
118
|
+
description:
|
119
|
+
"(standard, variable, useCeiling or ceilingRandomize) Decides what method to apply for pricing when the market comparable for the pricing group hits the ceiling price",
|
120
|
+
},
|
121
|
+
noCompPricingMethod: {
|
122
|
+
type: "string",
|
123
|
+
description:
|
124
|
+
"(standard, variable, ceiling, freezePricing, useFloorForAnchor, useCeilingForAnchor, useCeiling, ceilingRandomize) Decides what method to apply for pricing when there is no market comparables for the pricing group",
|
125
|
+
},
|
126
|
+
pricingGroupRequestRanks: {
|
127
|
+
type: "array",
|
128
|
+
description:
|
129
|
+
'Array of objects containing pricing group request ranks starting at 0 (anchor ticket). i.e [{"ticketGroupId": 1, "rank": 0},...]',
|
130
|
+
},
|
131
|
+
},
|
132
|
+
mandatory: ["pricingGroupId"],
|
133
|
+
};
|
134
|
+
|
135
|
+
toolHandler = async (request: CallToolRequest, httpClient: AxiosInstance) => {
|
136
|
+
try {
|
137
|
+
const pricingGroupId = request?.params?.arguments
|
138
|
+
?.pricingGroupId as number;
|
139
|
+
if (!pricingGroupId) {
|
140
|
+
throw new Error("Missing argument pricingGroupId");
|
141
|
+
}
|
142
|
+
const originalResponse = await httpClient.get<PricingGroupResponse>(
|
143
|
+
`/v2/client/pricing-group/${pricingGroupId}`
|
144
|
+
);
|
145
|
+
if (originalResponse.status !== 200) {
|
146
|
+
throw new Error(`API error: ${originalResponse.statusText}`);
|
147
|
+
}
|
148
|
+
if (!originalResponse.data) {
|
149
|
+
throw new Error(`Pricing group ${pricingGroupId} not found`);
|
150
|
+
}
|
151
|
+
const originalData = originalResponse.data;
|
152
|
+
|
153
|
+
const modifyArgs: PricingGroupUpdateRequest = {
|
154
|
+
productionId: originalData.productionId,
|
155
|
+
name: (request?.params?.arguments?.name as string) ?? originalData.name,
|
156
|
+
ceilingPrice:
|
157
|
+
(request?.params?.arguments?.ceilingPrice as number) ??
|
158
|
+
originalData.ceilingPrice,
|
159
|
+
floorPrice:
|
160
|
+
(request?.params?.arguments?.floorPrice as number) ??
|
161
|
+
originalData.floorPrice,
|
162
|
+
pricingGroupRequestType:
|
163
|
+
(request?.params?.arguments
|
164
|
+
?.pricingGroupRequestType as PricingGroupRequestType) ??
|
165
|
+
originalData.isAutoPricingEnabled
|
166
|
+
? PricingGroupRequestType.AutoPrice
|
167
|
+
: PricingGroupRequestType.SimulationOnly,
|
168
|
+
ruleSet: {
|
169
|
+
amount:
|
170
|
+
(request?.params?.arguments?.amount as number) ??
|
171
|
+
originalData.ruleSet.amount,
|
172
|
+
increment:
|
173
|
+
(request?.params?.arguments?.increment as string) ??
|
174
|
+
originalData.ruleSet.increment,
|
175
|
+
incrementMethod:
|
176
|
+
(request?.params?.arguments?.incrementMethod as string) ??
|
177
|
+
originalData.ruleSet.incrementMethod,
|
178
|
+
offsetAmount:
|
179
|
+
(request?.params?.arguments?.offsetAmount as number) ??
|
180
|
+
originalData.ruleSet.offsetAmount,
|
181
|
+
offsetIncrement:
|
182
|
+
(request?.params?.arguments?.offsetIncrement as string) ??
|
183
|
+
originalData.ruleSet.offsetIncrement,
|
184
|
+
offsetIncrementMethod:
|
185
|
+
(request?.params?.arguments?.offsetIncrementMethod as string) ??
|
186
|
+
originalData.ruleSet.offsetIncrementMethod,
|
187
|
+
enableShareOptions:
|
188
|
+
(request?.params?.arguments?.enableShareOptions as boolean) ??
|
189
|
+
originalData.ruleSet.enableShareOptions,
|
190
|
+
shareOptionsType:
|
191
|
+
(request?.params?.arguments
|
192
|
+
?.shareOptionsType as ShareOptionsType) ??
|
193
|
+
originalData.ruleSet.shareOptionsType,
|
194
|
+
shareAnchor:
|
195
|
+
(request?.params?.arguments?.shareAnchor as boolean) ??
|
196
|
+
originalData.ruleSet.shareAnchor,
|
197
|
+
customSharingAmount:
|
198
|
+
(request?.params?.arguments?.customSharingAmount as number) ??
|
199
|
+
originalData.ruleSet.customSharingAmount,
|
200
|
+
customSharingMethod:
|
201
|
+
(request?.params?.arguments
|
202
|
+
?.customSharingMethod as CustomSharingMethod) ??
|
203
|
+
originalData.ruleSet.customSharingMethod,
|
204
|
+
applyCeilingOnlyToAnchor:
|
205
|
+
(request?.params?.arguments?.applyCeilingOnlyToAnchor as boolean) ??
|
206
|
+
originalData.ruleSet.applyCeilingOnlyToAnchor,
|
207
|
+
applyFloorOnlyToAnchor:
|
208
|
+
(request?.params?.arguments?.applyFloorOnlyToAnchor as boolean) ??
|
209
|
+
originalData.ruleSet.applyFloorOnlyToAnchor,
|
210
|
+
floorPricingMethod:
|
211
|
+
(request?.params?.arguments
|
212
|
+
?.floorPricingMethod as FloorPricingMethod) ??
|
213
|
+
originalData.ruleSet.floorPricingMethod,
|
214
|
+
ceilingPricingMethod:
|
215
|
+
(request?.params?.arguments
|
216
|
+
?.ceilingPricingMethod as CeilingPricingMethod) ??
|
217
|
+
originalData.ruleSet.ceilingPricingMethod,
|
218
|
+
noCompPricingMethod:
|
219
|
+
(request?.params?.arguments
|
220
|
+
?.noCompPricingMethod as NoCompPricingMethod) ??
|
221
|
+
originalData.ruleSet.noCompPricingMethod,
|
222
|
+
},
|
223
|
+
pricingGroupRequestRanks: request?.params?.arguments
|
224
|
+
?.pricingGroupRequestRanks as {
|
225
|
+
ticketGroupId: number;
|
226
|
+
rank: number;
|
227
|
+
}[] ?? originalData.pricingGroupTickets?.map((ticket) => ({
|
228
|
+
ticketGroupId: ticket.ticketGroupId,
|
229
|
+
rank: ticket.rank
|
230
|
+
})),
|
231
|
+
marketGroupCriteria: originalData.marketGroupCriteria,
|
232
|
+
};
|
233
|
+
console.error("[API] Update Pricing Group:", modifyArgs);
|
234
|
+
const response = await httpClient.put<PricingGroupResponse>(
|
235
|
+
`/v2/client/pricing-group/${pricingGroupId}`,
|
236
|
+
modifyArgs
|
237
|
+
);
|
238
|
+
if (response.status !== 200) {
|
239
|
+
throw new Error(`API error: ${response.statusText}`);
|
240
|
+
}
|
241
|
+
return {
|
242
|
+
content: [{ type: "text", text: JSON.stringify([response.data]) }],
|
243
|
+
};
|
244
|
+
} catch (error) {
|
245
|
+
if (error instanceof Error) {
|
246
|
+
console.error("Error in Update Pricing Group:", error);
|
247
|
+
throw new McpError(
|
248
|
+
ErrorCode.InternalError,
|
249
|
+
`Failed to update pricing group: ${error.message}`
|
250
|
+
);
|
251
|
+
}
|
252
|
+
throw error;
|
253
|
+
}
|
254
|
+
};
|
255
|
+
}
|
@@ -13,6 +13,7 @@ export interface PricingGroupResponse {
|
|
13
13
|
dynamicMarketGroupCriteria: DynamicMarketGroupCriteriaDto;
|
14
14
|
pricingGroupTickets?: PricingGroupTicketsResult[] | null;
|
15
15
|
isAutoPricingEnabled: boolean;
|
16
|
+
productionId: number;
|
16
17
|
}
|
17
18
|
|
18
19
|
export enum LowerOutlierMethod{
|
@@ -127,7 +128,8 @@ export enum NoCompPricingMethod{
|
|
127
128
|
CeilingRandomize
|
128
129
|
}
|
129
130
|
|
130
|
-
export interface
|
131
|
+
export interface PricingGroupUpdateRequest{
|
132
|
+
productionId: number;
|
131
133
|
name?: string;
|
132
134
|
ceilingPrice?: number;
|
133
135
|
floorPrice?: number;
|
@@ -135,6 +137,17 @@ export interface PricingGroupRequest{
|
|
135
137
|
pricingGroupRequestRanks: TicketGroupRequestRank[];
|
136
138
|
ruleSet: RuleDto;
|
137
139
|
marketGroupCriteria: MarketCriteriaDto;
|
140
|
+
|
141
|
+
}
|
142
|
+
|
143
|
+
export interface PricingGroupRequest{
|
144
|
+
name?: string;
|
145
|
+
ceilingPrice?: number;
|
146
|
+
floorPrice?: number;
|
147
|
+
pricingGroupRequestType: PricingGroupRequestType;
|
148
|
+
pricingGroupRequestRanks: TicketGroupRequestRank[];
|
149
|
+
ruleSet: RuleDto;
|
150
|
+
marketGroupCriteria: MarketCriteriaDto;
|
138
151
|
productionId: number;
|
139
152
|
pricingTemplateId?: number;
|
140
153
|
}
|