mcp-prqx-pricer 1.0.13 → 1.0.14

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.
@@ -104,28 +104,34 @@ class CreatePricingGroupTool {
104
104
  if (!request?.params?.arguments) {
105
105
  throw new Error('Missing arguments');
106
106
  }
107
+ const pricingGroupRequestRanks = request.params.arguments.pricingGroupRequestRanks;
108
+ const anchorTicketGroupId = pricingGroupRequestRanks.find(rank => rank.rank === 0)?.ticketGroupId;
109
+ if (!anchorTicketGroupId) {
110
+ throw new Error('Anchor ticket group ID is required');
111
+ }
112
+ const defaultsResponse = await httpClient.get('/v1/client/org-defaults/calculate-defaults/' + anchorTicketGroupId);
113
+ const defaults = defaultsResponse.data;
107
114
  const productionId = request.params.arguments.productionId;
108
115
  const name = request.params.arguments.name;
109
- const ceilingPrice = request.params.arguments.ceilingPrice;
110
- const floorPrice = request.params.arguments.floorPrice;
116
+ const ceilingPrice = request.params.arguments.ceilingPrice ?? defaults.ruleSet.ceiling;
117
+ const floorPrice = request.params.arguments.floorPrice ?? defaults.ruleSet.floor;
111
118
  const pricingGroupRequestType = request.params.arguments.pricingGroupMode;
112
- const amount = request.params.arguments.amount;
113
- const increment = request.params.arguments.increment;
114
- const incrementMethod = request.params.arguments.incrementMethod;
115
- const offsetAmount = request.params.arguments.offsetAmount;
116
- const offsetIncrement = request.params.arguments.offsetIncrement;
117
- const offsetIncrementMethod = request.params.arguments.offsetIncrementMethod;
118
- const enableShareOptions = request.params.arguments.enableShareOptions;
119
- const shareOptionsType = request.params.arguments.shareOptionsType;
120
- const shareAnchor = request.params.arguments.shareAnchor;
121
- const customSharingAmount = request.params.arguments.customSharingAmount;
122
- const customSharingMethod = request.params.arguments.customSharingMethod;
123
- const applyCeilingOnlyToAnchor = request.params.arguments.applyCeilingOnlyToAnchor;
124
- const applyFloorOnlyToAnchor = request.params.arguments.applyFloorOnlyToAnchor;
125
- const floorPricingMethod = request.params.arguments.floorPricingMethod;
126
- const ceilingPricingMethod = request.params.arguments.ceilingPricingMethod;
127
- const noCompPricingMethod = request.params.arguments.noCompPricingMethod;
128
- const pricingGroupRequestRanks = request.params.arguments.pricingGroupRequestRanks;
119
+ const amount = request.params.arguments.amount ?? defaults.ruleSet.amount;
120
+ const increment = request.params.arguments.increment ?? defaults.ruleSet.increment;
121
+ const incrementMethod = request.params.arguments.incrementMethod ?? defaults.ruleSet.incrementMethod;
122
+ const offsetAmount = request.params.arguments.offsetAmount ?? defaults.ruleSet.offsetAmount;
123
+ const offsetIncrement = request.params.arguments.offsetIncrement ?? defaults.ruleSet.offsetIncrement;
124
+ const offsetIncrementMethod = request.params.arguments.offsetIncrementMethod ?? defaults.ruleSet.offsetIncrementMethod;
125
+ const enableShareOptions = request.params.arguments.enableShareOptions ?? defaults.ruleSet.enableShareOptions;
126
+ const shareOptionsType = request.params.arguments.shareOptionsType ?? defaults.ruleSet.shareOptionsType;
127
+ const shareAnchor = request.params.arguments.shareAnchor ?? defaults.ruleSet.shareAnchor;
128
+ const customSharingAmount = request.params.arguments.customSharingAmount ?? defaults.ruleSet.customSharingAmount;
129
+ const customSharingMethod = request.params.arguments.customSharingMethod ?? defaults.ruleSet.customSharingMethod;
130
+ const applyCeilingOnlyToAnchor = request.params.arguments.applyCeilingOnlyToAnchor ?? defaults.ruleSet.applyCeilingOnlyToAnchor;
131
+ const applyFloorOnlyToAnchor = request.params.arguments.applyFloorOnlyToAnchor ?? defaults.ruleSet.applyFloorOnlyToAnchor;
132
+ const floorPricingMethod = request.params.arguments.floorPricingMethod ?? defaults.ruleSet.floorPricingMethod;
133
+ const ceilingPricingMethod = request.params.arguments.ceilingPricingMethod ?? defaults.ruleSet.ceilingPricingMethod;
134
+ const noCompPricingMethod = request.params.arguments.noCompPricingMethod ?? defaults.ruleSet.noCompPricingMethod;
129
135
  const args = {
130
136
  productionId: productionId,
131
137
  name: name,
@@ -151,14 +157,24 @@ class CreatePricingGroupTool {
151
157
  noCompPricingMethod: noCompPricingMethod
152
158
  },
153
159
  marketGroupCriteria: {
154
- sections: []
160
+ sections: defaults?.marketGroupCriteria?.sections ?? [],
161
+ validSplitsIncludeV2: defaults?.marketGroupCriteria?.validSplitsIncludeV2,
162
+ validSplitsIncludeMax: defaults?.marketGroupCriteria?.validSplitsIncludeMax,
163
+ deliveryMethodInclude: defaults?.marketGroupCriteria?.deliveryMethodInclude,
164
+ attributesExclude: defaults?.marketGroupCriteria?.attributesExclude,
165
+ lowerOutlierMethod: defaults?.marketGroupCriteria?.lowerOutlierMethod,
166
+ lowerOutlierAmount: defaults?.marketGroupCriteria?.lowerOutlierAmount,
167
+ lowerOutlierThreshold: defaults?.marketGroupCriteria?.lowerOutlierThreshold,
168
+ includeSpeculativeTickets: defaults?.marketGroupCriteria?.includeSpeculativeTickets,
169
+ isSplitsDynamic: defaults?.marketGroupCriteria?.isSplitsDynamic,
170
+ rowRanges: defaults?.marketGroupCriteria?.rowRanges
155
171
  },
156
172
  pricingGroupRequestRanks: pricingGroupRequestRanks
157
173
  };
158
174
  console.error('[API] Create Pricing Group with arguments:', args);
159
175
  const response = await httpClient.post(`/v2/client/pricing-group`, args);
160
176
  if (response.status !== 200) {
161
- throw new Error(`API error: ${response.statusText}`);
177
+ throw new Error("API error: " + response.statusText);
162
178
  }
163
179
  return { content: [{ type: 'text', text: JSON.stringify([response.data]) }] };
164
180
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-prqx-pricer",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -0,0 +1,37 @@
1
+ #Role and Objective
2
+ You are an Agent that can help ticket brokers to organize their
3
+ inventory in pricing groups (Creating, Editing or Deleting) or to obtaining
4
+ information about their current ticket groups and pricing groups existent.
5
+
6
+ Please keep going until the user's command is fully completed, before ending your turn
7
+ and yielding back to the user. Only terminate your turn when you are sure the problem
8
+ is solved.
9
+
10
+ You should be able to complete your tasks using only the tools provided. Is important to always
11
+ include as first step of your execution plan checking the list of available tools and their parameters.
12
+ Make sure you use the tools result to gather the required data to call other tools. Don't make assumptions outside
13
+ the data provided by the tools.
14
+
15
+ Only provide to the tools relevant arguments and mandatory values. The tools will default other
16
+ parameters with organization defaults.
17
+
18
+ You MUST plan extensively the execution of the command before starting it.
19
+ Check the list of available tools and plan the execution of the command to minimize the number of calls.
20
+
21
+ Reflect extensively on the outcomes of the previous function calls and try to use the information gathered
22
+ from previous calls to make better decisions.
23
+
24
+ #Context
25
+ Today's date is {{ $now }}
26
+
27
+ #Instructions
28
+ 1. First step check the list of tools available and only use those for further operations
29
+ 2. Locate the information the user is looking for. Always start narrowing the productions relevant for the task
30
+ 3. Query for ticket groups and/or pricing groups as the task requires using the ProductionId(s) gathered in step 2
31
+ 4. Execute the task using Create, Update or Delete tools
32
+
33
+ #Rules
34
+ 1. A ticket group can be in only one pricing group at a time
35
+ 2. By default always create pricing groups in Simulation mode unless explicitly stated for the user to be Auto Price
36
+ 3. You can not create pricing groups with ticket groups that are already assigned to another pricing group
37
+ 4. The anchor ticket in a pricing group is the ticket group with rank 0 and is mandatory to create a pricing group
@@ -0,0 +1,20 @@
1
+ <agentInstructions>
2
+ <goal>
3
+ Help ticket brokers to organize their inventory in pricing groups (Creating, Editing or Deleting).
4
+ or to obtain information about their inventory and pricing groups existent.
5
+ </goal>
6
+ <rule>today's date is {{ $now }}</rule>
7
+ <rule>IMPORTANT! First step check the list of tools available and only use those for further operations</rule>
8
+ <rule>After querying the list of available tools you can store it in memory and don't repeat the call to list tools for every step</rule>
9
+ <rule>Once you determine the plan of execution of a command give the user the feedback of how you are going to proceed</rule>
10
+ <rule>IMPORTANT! For production search use one year in the future as maximum period if no date period is mentioned by the user</rule>
11
+ <rule>To get inventory or pricing groups for multiple productions you need to query for the productions first and then use the productionId to query for inventory or pricing groups related to that production</rule>
12
+ <rule>IMPORTANT! A ticket group can be in only one pricing group at a time</rule>
13
+ <rule>By default always create pricing groups in Simulation mode unless explicitly stated for the user to be Auto Price</rule>
14
+ <rule>IMPORTANT! You can not create pricing groups with Ticket groups that are already assigned to other pricing group</rule>
15
+ <rule>Query the pricing groups and validate which ticket groups are already assigned to a pricing group before creating or modifying a pricing group</rule>
16
+ <rule>Pricing group names must be unique per production</rule>
17
+ <rule>Pricing groups cannot be created without a list of pricingGroupRequestedRanks (List of ticket groups in the group ordered by rank)</rule>
18
+ <rule>When creating or updating pricing groups don't provide values for the NON MANDATORY fields unless user provide explicit instructions for them</rule>
19
+ <rule>If any of the tools fail when executing a step. Abort the execution inmediately and inform the user of the failure. Don't retry</rule>
20
+ </agentInstructions>
@@ -1,7 +1,7 @@
1
1
  import { McpTool } from "../types/tool";
2
2
  import { CallToolRequest, ErrorCode, McpError } from "@modelcontextprotocol/sdk/types.js";
3
3
  import axios from "axios";
4
- import { CeilingPricingMethod, CustomSharingMethod, FloorPricingMethod, NoCompPricingMethod, PricingGroupRequest, PricingGroupRequestType, PricingGroupResponse, ShareOptionsType, TicketGroupRequestRank } from "../types/pricingGroup";
4
+ import { CeilingPricingMethod, CustomSharingMethod, FloorPricingMethod, NoCompPricingMethod, PricingGroupRequest, PricingGroupRequestType, PricingGroupResponse, ShareOptionsType, TicketGroupOrgDefaultResponse, TicketGroupRequestRank } from "../types/pricingGroup";
5
5
 
6
6
  export class CreatePricingGroupTool implements McpTool {
7
7
  name = 'CreatePricingGroup';
@@ -106,28 +106,37 @@ export class CreatePricingGroupTool implements McpTool {
106
106
  throw new Error('Missing arguments');
107
107
  }
108
108
 
109
+ const pricingGroupRequestRanks = request.params.arguments.pricingGroupRequestRanks as TicketGroupRequestRank[];
110
+
111
+ const anchorTicketGroupId = pricingGroupRequestRanks.find(rank => rank.rank === 0)?.ticketGroupId;
112
+ if (!anchorTicketGroupId) {
113
+ throw new Error('Anchor ticket group ID is required');
114
+ }
115
+
116
+ const defaultsResponse = await httpClient.get<TicketGroupOrgDefaultResponse>('/v1/client/org-defaults/calculate-defaults/' + anchorTicketGroupId);
117
+ const defaults = defaultsResponse.data;
118
+
109
119
  const productionId = request.params.arguments.productionId as number;
110
120
  const name = request.params.arguments.name as string;
111
- const ceilingPrice = request.params.arguments.ceilingPrice as number;
112
- const floorPrice = request.params.arguments.floorPrice as number;
121
+ const ceilingPrice = request.params.arguments.ceilingPrice as number ?? defaults.ruleSet.ceiling;
122
+ const floorPrice = request.params.arguments.floorPrice as number ?? defaults.ruleSet.floor;
113
123
  const pricingGroupRequestType = request.params.arguments.pricingGroupMode as PricingGroupRequestType;
114
- const amount = request.params.arguments.amount as number;
115
- const increment = request.params.arguments.increment as string;
116
- const incrementMethod = request.params.arguments.incrementMethod as string;
117
- const offsetAmount = request.params.arguments.offsetAmount as number | undefined;
118
- const offsetIncrement = request.params.arguments.offsetIncrement as string | undefined;
119
- const offsetIncrementMethod = request.params.arguments.offsetIncrementMethod as string | undefined;
120
- const enableShareOptions = request.params.arguments.enableShareOptions as boolean | undefined;
121
- const shareOptionsType = request.params.arguments.shareOptionsType as ShareOptionsType | undefined;
122
- const shareAnchor = request.params.arguments.shareAnchor as boolean | undefined;
123
- const customSharingAmount = request.params.arguments.customSharingAmount as number | undefined;
124
- const customSharingMethod = request.params.arguments.customSharingMethod as CustomSharingMethod | undefined;
125
- const applyCeilingOnlyToAnchor = request.params.arguments.applyCeilingOnlyToAnchor as boolean | undefined;
126
- const applyFloorOnlyToAnchor = request.params.arguments.applyFloorOnlyToAnchor as boolean | undefined;
127
- const floorPricingMethod = request.params.arguments.floorPricingMethod as FloorPricingMethod | undefined;
128
- const ceilingPricingMethod = request.params.arguments.ceilingPricingMethod as CeilingPricingMethod | undefined;
129
- const noCompPricingMethod = request.params.arguments.noCompPricingMethod as NoCompPricingMethod | undefined;
130
- const pricingGroupRequestRanks = request.params.arguments.pricingGroupRequestRanks as TicketGroupRequestRank[];
124
+ const amount = request.params.arguments.amount as number ?? defaults.ruleSet.amount;
125
+ const increment = request.params.arguments.increment as string ?? defaults.ruleSet.increment;
126
+ const incrementMethod = request.params.arguments.incrementMethod as string ?? defaults.ruleSet.incrementMethod;
127
+ const offsetAmount = request.params.arguments.offsetAmount as number | undefined ?? defaults.ruleSet.offsetAmount;
128
+ const offsetIncrement = request.params.arguments.offsetIncrement as string | undefined ?? defaults.ruleSet.offsetIncrement;
129
+ const offsetIncrementMethod = request.params.arguments.offsetIncrementMethod as string | undefined ?? defaults.ruleSet.offsetIncrementMethod;
130
+ const enableShareOptions = request.params.arguments.enableShareOptions as boolean | undefined ?? defaults.ruleSet.enableShareOptions;
131
+ const shareOptionsType = request.params.arguments.shareOptionsType as ShareOptionsType | undefined ?? defaults.ruleSet.shareOptionsType;
132
+ const shareAnchor = request.params.arguments.shareAnchor as boolean | undefined ?? defaults.ruleSet.shareAnchor;
133
+ const customSharingAmount = request.params.arguments.customSharingAmount as number | undefined ?? defaults.ruleSet.customSharingAmount;
134
+ const customSharingMethod = request.params.arguments.customSharingMethod as CustomSharingMethod | undefined ?? defaults.ruleSet.customSharingMethod;
135
+ const applyCeilingOnlyToAnchor = request.params.arguments.applyCeilingOnlyToAnchor as boolean | undefined ?? defaults.ruleSet.applyCeilingOnlyToAnchor;
136
+ const applyFloorOnlyToAnchor = request.params.arguments.applyFloorOnlyToAnchor as boolean | undefined ?? defaults.ruleSet.applyFloorOnlyToAnchor;
137
+ const floorPricingMethod = request.params.arguments.floorPricingMethod as FloorPricingMethod | undefined ?? defaults.ruleSet.floorPricingMethod;
138
+ const ceilingPricingMethod = request.params.arguments.ceilingPricingMethod as CeilingPricingMethod | undefined ?? defaults.ruleSet.ceilingPricingMethod;
139
+ const noCompPricingMethod = request.params.arguments.noCompPricingMethod as NoCompPricingMethod | undefined ?? defaults.ruleSet.noCompPricingMethod;
131
140
 
132
141
  const args : PricingGroupRequest = {
133
142
  productionId: productionId,
@@ -154,14 +163,24 @@ export class CreatePricingGroupTool implements McpTool {
154
163
  noCompPricingMethod: noCompPricingMethod
155
164
  },
156
165
  marketGroupCriteria: {
157
- sections: []
166
+ sections: defaults?.marketGroupCriteria?.sections ?? [],
167
+ validSplitsIncludeV2: defaults?.marketGroupCriteria?.validSplitsIncludeV2,
168
+ validSplitsIncludeMax: defaults?.marketGroupCriteria?.validSplitsIncludeMax,
169
+ deliveryMethodInclude: defaults?.marketGroupCriteria?.deliveryMethodInclude,
170
+ attributesExclude: defaults?.marketGroupCriteria?.attributesExclude,
171
+ lowerOutlierMethod: defaults?.marketGroupCriteria?.lowerOutlierMethod,
172
+ lowerOutlierAmount: defaults?.marketGroupCriteria?.lowerOutlierAmount,
173
+ lowerOutlierThreshold: defaults?.marketGroupCriteria?.lowerOutlierThreshold,
174
+ includeSpeculativeTickets: defaults?.marketGroupCriteria?.includeSpeculativeTickets,
175
+ isSplitsDynamic: defaults?.marketGroupCriteria?.isSplitsDynamic,
176
+ rowRanges: defaults?.marketGroupCriteria?.rowRanges
158
177
  },
159
178
  pricingGroupRequestRanks: pricingGroupRequestRanks
160
179
  };
161
180
  console.error('[API] Create Pricing Group with arguments:', args);
162
181
  const response = await httpClient.post<PricingGroupResponse>(`/v2/client/pricing-group`, args);
163
182
  if (response.status !== 200) {
164
- throw new Error(`API error: ${response.statusText}`);
183
+ throw new Error("API error: " + response.statusText);
165
184
  }
166
185
  return { content: [{ type: 'text', text: JSON.stringify([response.data]) }] };
167
186
  } catch (error) {
@@ -157,5 +157,69 @@ export interface TicketGroupRequestRank{
157
157
  rank: number;
158
158
  }
159
159
 
160
+ export interface TicketGroupOrgDefaultResponse{
161
+ ruleSet: {
162
+ ceiling?: number;
163
+ isCeilingOrgDefault: boolean;
164
+ floor?: number;
165
+ isFloorOrgDefault: boolean;
166
+ increment?: string;
167
+ isIncrementOrgDefault: boolean;
168
+ incrementMethod?: string;
169
+ isIncrementMethodOrgDefault: boolean;
170
+ amount?: number;
171
+ isAmountOrgDefault: boolean;
172
+ offsetIncrement?: string;
173
+ isOffsetIncrementOrgDefault: boolean;
174
+ offsetIncrementMethod?: string;
175
+ isOffsetIncrementMethodOrgDefault: boolean;
176
+ offsetAmount?: number;
177
+ isOffsetAmountOrgDefault: boolean,
178
+ enableShareOptions?: boolean;
179
+ isEnableShareOptionsOrgDefault: boolean;
180
+ shareOptionsType?: ShareOptionsType;
181
+ isShareOptionsTypeOrgDefault: boolean;
182
+ shareAnchor?: boolean;
183
+ isShareAnchorOrgDefault: boolean;
184
+ pricingGroupRequestType?: PricingGroupRequestType;
185
+ isPricingGroupRequestTypeOrgDefault: boolean;
186
+ floorPricingMethod?: FloorPricingMethod;
187
+ isFloorPricingMethodOrgDefault: boolean;
188
+ ceilingPricingMethod?: CeilingPricingMethod;
189
+ isCeilingPricingMethodOrgDefault: boolean;
190
+ noCompPricingMethod?: NoCompPricingMethod;
191
+ isNoCompPricingMethodOrgDefault: boolean;
192
+ customSharingAmount?: number;
193
+ isCustomSharingAmountOrgDefault: boolean;
194
+ customSharingMethod?: CustomSharingMethod;
195
+ isCustomSharingMethodOrgDefault: boolean;
196
+ applyCeilingOnlyToAnchor?: boolean;
197
+ isApplyCeilingOnlyToAnchorOrgDefault: boolean;
198
+ applyFloorOnlyToAnchor?: boolean;
199
+ isApplyFloorOnlyToAnchorOrgDefault: boolean
200
+ },
201
+ marketGroupCriteria?: {
202
+ sections?: SectionDto[],
203
+ validSplitsIncludeV2?: number[],
204
+ validSplitsIncludeMax?: boolean,
205
+ deliveryMethodInclude?: string[],
206
+ attributesExclude?: string[],
207
+ lowerOutlierMethod?: LowerOutlierMethod,
208
+ lowerOutlierAmount?: number,
209
+ lowerOutlierThreshold?: number,
210
+ includeSpeculativeTickets?: boolean,
211
+ isSplitsDynamic?: boolean,
212
+ isSectionEnabled?: boolean,
213
+ rowRanges?: RowRange[]
214
+ },
215
+ dynamicMarketGroupCriteria?: {
216
+ validSplitsV2?: {
217
+ splits?: number[] | null;
218
+ includeMax?: boolean;
219
+ }
220
+ },
221
+ isCeilingRequired: boolean
222
+ }
223
+
160
224
  // The response for the endpoint is an array of PricingGroupResponse
161
225
  export type GetPricingGroupByProductionIdResponse = PricingGroupResponse[];