mcp-prqx-pricer 1.0.4 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.js +4 -0
- package/build/tools/createPricingGroup.js +172 -0
- package/build/tools/getPricingGroups.js +37 -0
- package/build/types/pricingGroup.js +53 -0
- package/package.json +1 -1
- package/src/index.ts +4 -0
- package/src/tools/createPricingGroup.ts +174 -0
- package/src/tools/getPricingGroups.ts +37 -0
- package/src/types/pricingGroup.ts +148 -0
package/build/index.js
CHANGED
@@ -10,6 +10,8 @@ const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
|
|
10
10
|
const axios_1 = __importDefault(require("axios"));
|
11
11
|
const getProductions_1 = require("./tools/getProductions");
|
12
12
|
const getProductionInventory_1 = require("./tools/getProductionInventory");
|
13
|
+
const getPricingGroups_1 = require("./tools/getPricingGroups");
|
14
|
+
const createPricingGroup_1 = require("./tools/createPricingGroup");
|
13
15
|
class PrqxMcpServer {
|
14
16
|
server;
|
15
17
|
axiosInstance;
|
@@ -33,6 +35,8 @@ class PrqxMcpServer {
|
|
33
35
|
});
|
34
36
|
this.tools.push(new getProductions_1.GetProductionsTool());
|
35
37
|
this.tools.push(new getProductionInventory_1.GetProductionInventoryTool());
|
38
|
+
this.tools.push(new getPricingGroups_1.GetPricingGroupsTool());
|
39
|
+
this.tools.push(new createPricingGroup_1.CreatePricingGroupTool());
|
36
40
|
this.setupToolHandlers();
|
37
41
|
this.server.onerror = (error) => {
|
38
42
|
console.error('[Error] MCP server error:', error);
|
@@ -0,0 +1,172 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.CreatePricingGroupTool = void 0;
|
4
|
+
const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
|
5
|
+
class CreatePricingGroupTool {
|
6
|
+
name = 'CreatePricingGroup';
|
7
|
+
description = 'Create a new pricing group';
|
8
|
+
inputSchema = {
|
9
|
+
type: 'object',
|
10
|
+
properties: {
|
11
|
+
productionId: {
|
12
|
+
type: 'number',
|
13
|
+
description: 'ID of the production that the pricing group will be created for'
|
14
|
+
},
|
15
|
+
name: {
|
16
|
+
type: 'string',
|
17
|
+
description: 'Name of the pricing group'
|
18
|
+
},
|
19
|
+
ceilingPrice: {
|
20
|
+
type: 'number',
|
21
|
+
description: 'Maximum price that the pricing group tickets can have'
|
22
|
+
},
|
23
|
+
floorPrice: {
|
24
|
+
type: 'number',
|
25
|
+
description: 'Minimum price that the pricing group tickets can have'
|
26
|
+
},
|
27
|
+
pricingGroupMode: {
|
28
|
+
type: 'string',
|
29
|
+
description: '(AutoPrice or SimulationOnly) Mode of the pricing group'
|
30
|
+
},
|
31
|
+
amount: {
|
32
|
+
type: 'number',
|
33
|
+
description: 'Amount used to price the anchor ticket of the pricing group based on the first market comparable'
|
34
|
+
},
|
35
|
+
increment: {
|
36
|
+
type: 'string',
|
37
|
+
description: '(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'
|
38
|
+
},
|
39
|
+
incrementMethod: {
|
40
|
+
type: 'string',
|
41
|
+
description: '( % or $ ) Decides if the amount is applied as a percentage or a dollar amount'
|
42
|
+
},
|
43
|
+
offsetAmount: {
|
44
|
+
type: 'number',
|
45
|
+
description: 'Offset amount used to price the other tickets in the group based of the previously ranked ticket'
|
46
|
+
},
|
47
|
+
offsetIncrement: {
|
48
|
+
type: 'string',
|
49
|
+
description: '(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'
|
50
|
+
},
|
51
|
+
offsetIncrementMethod: {
|
52
|
+
type: 'string',
|
53
|
+
description: '( % or $ ) Decides if the offset amount is applied as a percentage or a dollar amount'
|
54
|
+
},
|
55
|
+
enableShareOptions: {
|
56
|
+
type: 'boolean',
|
57
|
+
description: 'Decides if the pricing group will control the sharing of tickets in a marketplace or not'
|
58
|
+
},
|
59
|
+
shareOptionsType: {
|
60
|
+
type: 'string',
|
61
|
+
description: '(custom or all) Decides if we use custom parameters to share the tickets in the group or if we share them all'
|
62
|
+
},
|
63
|
+
shareAnchor: {
|
64
|
+
type: 'number',
|
65
|
+
description: 'Controls if the anchor ticket of the pricing group will be shared'
|
66
|
+
},
|
67
|
+
customSharingAmount: {
|
68
|
+
type: 'number',
|
69
|
+
description: 'Custom sharing amount use to determine which tickets to share of this pricing group'
|
70
|
+
},
|
71
|
+
customSharingMethod: {
|
72
|
+
type: 'string',
|
73
|
+
description: '( % or $ ) Decides if the custom sharing amount is applied as a percentage or a dollar amount'
|
74
|
+
},
|
75
|
+
applyCeilingOnlyToAnchor: {
|
76
|
+
type: 'boolean',
|
77
|
+
description: 'Decides if the ceiling price will be applied only to the anchor ticket of the pricing group'
|
78
|
+
},
|
79
|
+
applyFloorOnlyToAnchor: {
|
80
|
+
type: 'boolean',
|
81
|
+
description: 'Decides if the floor price will be applied only to the anchor ticket of the pricing group'
|
82
|
+
},
|
83
|
+
floorPricingMethod: {
|
84
|
+
type: 'string',
|
85
|
+
description: '(standard, variable, useFloor or floorRandomize) Decides what method to apply for pricing when the market comparable for the pricing group hits the floor price'
|
86
|
+
},
|
87
|
+
ceilingPricingMethod: {
|
88
|
+
type: 'string',
|
89
|
+
description: '(standard, variable, useCeiling or ceilingRandomize) Decides what method to apply for pricing when the market comparable for the pricing group hits the ceiling price'
|
90
|
+
},
|
91
|
+
noCompPricingMethod: {
|
92
|
+
type: 'string',
|
93
|
+
description: '(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'
|
94
|
+
},
|
95
|
+
pricingGroupRequestRanks: {
|
96
|
+
type: 'array',
|
97
|
+
description: 'Array of objects containing pricing group request ranks starting at 0 (anchor ticket). i.e [{"ticketGroupId": 1, "rank": 0},...]'
|
98
|
+
}
|
99
|
+
},
|
100
|
+
mandatory: ['productionId', 'name', 'ceilingPrice', 'floorPrice', 'pricingGroupMode', 'amount', 'increment', 'incrementMethod', 'pricingGroupRequestRanks']
|
101
|
+
};
|
102
|
+
toolHandler = async (request, httpClient) => {
|
103
|
+
try {
|
104
|
+
if (!request?.params?.arguments) {
|
105
|
+
throw new Error('Missing arguments');
|
106
|
+
}
|
107
|
+
const productionId = request.params.arguments.productionId;
|
108
|
+
const name = request.params.arguments.name;
|
109
|
+
const ceilingPrice = request.params.arguments.ceilingPrice;
|
110
|
+
const floorPrice = request.params.arguments.floorPrice;
|
111
|
+
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;
|
129
|
+
const args = {
|
130
|
+
productionId: productionId,
|
131
|
+
name: name,
|
132
|
+
ceilingPrice: ceilingPrice,
|
133
|
+
floorPrice: floorPrice,
|
134
|
+
pricingGroupRequestType: pricingGroupRequestType,
|
135
|
+
ruleSet: {
|
136
|
+
amount: amount,
|
137
|
+
increment: increment,
|
138
|
+
incrementMethod: incrementMethod,
|
139
|
+
offsetAmount: offsetAmount,
|
140
|
+
offsetIncrement: offsetIncrement,
|
141
|
+
offsetIncrementMethod: offsetIncrementMethod,
|
142
|
+
enableShareOptions: enableShareOptions,
|
143
|
+
shareOptionsType: shareOptionsType,
|
144
|
+
shareAnchor: shareAnchor,
|
145
|
+
customSharingAmount: customSharingAmount,
|
146
|
+
customSharingMethod: customSharingMethod,
|
147
|
+
applyCeilingOnlyToAnchor: applyCeilingOnlyToAnchor,
|
148
|
+
applyFloorOnlyToAnchor: applyFloorOnlyToAnchor,
|
149
|
+
floorPricingMethod: floorPricingMethod,
|
150
|
+
ceilingPricingMethod: ceilingPricingMethod,
|
151
|
+
noCompPricingMethod: noCompPricingMethod
|
152
|
+
},
|
153
|
+
marketGroupCriteria: {},
|
154
|
+
pricingGroupRequestRanks: pricingGroupRequestRanks
|
155
|
+
};
|
156
|
+
console.error('[API] Create Pricing Group with arguments:', args);
|
157
|
+
const response = await httpClient.post(`/v2/client/pricing-group`, args);
|
158
|
+
if (response.status !== 200) {
|
159
|
+
throw new Error(`API error: ${response.statusText}`);
|
160
|
+
}
|
161
|
+
return { content: [{ type: 'text', text: JSON.stringify(response.data) }] };
|
162
|
+
}
|
163
|
+
catch (error) {
|
164
|
+
if (error instanceof Error) {
|
165
|
+
console.error('Error in Create Pricing Group:', error);
|
166
|
+
throw new types_js_1.McpError(types_js_1.ErrorCode.InternalError, `Failed to create pricing group: ${error.message}`);
|
167
|
+
}
|
168
|
+
throw error;
|
169
|
+
}
|
170
|
+
};
|
171
|
+
}
|
172
|
+
exports.CreatePricingGroupTool = CreatePricingGroupTool;
|
@@ -0,0 +1,37 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.GetPricingGroupsTool = void 0;
|
4
|
+
const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
|
5
|
+
class GetPricingGroupsTool {
|
6
|
+
name = 'GetPricingGroups';
|
7
|
+
description = 'Get the organization pricing groups for a single production';
|
8
|
+
inputSchema = {
|
9
|
+
type: 'object',
|
10
|
+
properties: {
|
11
|
+
productionId: {
|
12
|
+
type: 'number',
|
13
|
+
description: 'ID of the production'
|
14
|
+
}
|
15
|
+
},
|
16
|
+
mandatory: ['productionId']
|
17
|
+
};
|
18
|
+
toolHandler = async (request, httpClient) => {
|
19
|
+
try {
|
20
|
+
const args = request.params.arguments;
|
21
|
+
console.error('[API] Get Pricing Groups with arguments:', args);
|
22
|
+
const response = await httpClient.get(`/v2/client/pricing-group/production/${args.productionId}`);
|
23
|
+
if (response.status !== 200) {
|
24
|
+
throw new Error(`API error: ${response.statusText}`);
|
25
|
+
}
|
26
|
+
return { content: [{ type: 'text', text: JSON.stringify(response.data) }] };
|
27
|
+
}
|
28
|
+
catch (error) {
|
29
|
+
if (error instanceof Error) {
|
30
|
+
console.error('Error in Get Pricing Groups:', error);
|
31
|
+
throw new types_js_1.McpError(types_js_1.ErrorCode.InternalError, `Failed to fetch data: ${error.message}`);
|
32
|
+
}
|
33
|
+
throw error;
|
34
|
+
}
|
35
|
+
};
|
36
|
+
}
|
37
|
+
exports.GetPricingGroupsTool = GetPricingGroupsTool;
|
@@ -0,0 +1,53 @@
|
|
1
|
+
"use strict";
|
2
|
+
// TypeScript interfaces for /v2/client/pricing-group/production/{ProductionId} response
|
3
|
+
// Generated based on OpenAPI pricer.json
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
5
|
+
exports.NoCompPricingMethod = exports.CeilingPricingMethod = exports.FloorPricingMethod = exports.ShareOptionsType = exports.CustomSharingMethod = exports.PricingGroupRequestType = exports.LowerOutlierMethod = void 0;
|
6
|
+
var LowerOutlierMethod;
|
7
|
+
(function (LowerOutlierMethod) {
|
8
|
+
LowerOutlierMethod[LowerOutlierMethod["Quantity"] = 0] = "Quantity";
|
9
|
+
LowerOutlierMethod[LowerOutlierMethod["Currency"] = 1] = "Currency";
|
10
|
+
LowerOutlierMethod[LowerOutlierMethod["Percentage"] = 2] = "Percentage";
|
11
|
+
LowerOutlierMethod[LowerOutlierMethod["PercentThresholdOfPosition"] = 3] = "PercentThresholdOfPosition";
|
12
|
+
LowerOutlierMethod[LowerOutlierMethod["CurrencyThresholdOfPosition"] = 4] = "CurrencyThresholdOfPosition";
|
13
|
+
})(LowerOutlierMethod || (exports.LowerOutlierMethod = LowerOutlierMethod = {}));
|
14
|
+
var PricingGroupRequestType;
|
15
|
+
(function (PricingGroupRequestType) {
|
16
|
+
PricingGroupRequestType[PricingGroupRequestType["AutoPrice"] = 0] = "AutoPrice";
|
17
|
+
PricingGroupRequestType[PricingGroupRequestType["SimulationOnly"] = 1] = "SimulationOnly";
|
18
|
+
})(PricingGroupRequestType || (exports.PricingGroupRequestType = PricingGroupRequestType = {}));
|
19
|
+
var CustomSharingMethod;
|
20
|
+
(function (CustomSharingMethod) {
|
21
|
+
CustomSharingMethod["Percentage"] = "%";
|
22
|
+
CustomSharingMethod["Currency"] = "$";
|
23
|
+
})(CustomSharingMethod || (exports.CustomSharingMethod = CustomSharingMethod = {}));
|
24
|
+
var ShareOptionsType;
|
25
|
+
(function (ShareOptionsType) {
|
26
|
+
ShareOptionsType[ShareOptionsType["Custom"] = 0] = "Custom";
|
27
|
+
ShareOptionsType[ShareOptionsType["All"] = 1] = "All";
|
28
|
+
})(ShareOptionsType || (exports.ShareOptionsType = ShareOptionsType = {}));
|
29
|
+
var FloorPricingMethod;
|
30
|
+
(function (FloorPricingMethod) {
|
31
|
+
FloorPricingMethod[FloorPricingMethod["Standard"] = 0] = "Standard";
|
32
|
+
FloorPricingMethod[FloorPricingMethod["Variable"] = 1] = "Variable";
|
33
|
+
FloorPricingMethod[FloorPricingMethod["UseFloor"] = 2] = "UseFloor";
|
34
|
+
FloorPricingMethod[FloorPricingMethod["FloorRandomize"] = 3] = "FloorRandomize";
|
35
|
+
})(FloorPricingMethod || (exports.FloorPricingMethod = FloorPricingMethod = {}));
|
36
|
+
var CeilingPricingMethod;
|
37
|
+
(function (CeilingPricingMethod) {
|
38
|
+
CeilingPricingMethod[CeilingPricingMethod["Standard"] = 0] = "Standard";
|
39
|
+
CeilingPricingMethod[CeilingPricingMethod["Variable"] = 1] = "Variable";
|
40
|
+
CeilingPricingMethod[CeilingPricingMethod["UseCeiling"] = 2] = "UseCeiling";
|
41
|
+
CeilingPricingMethod[CeilingPricingMethod["CeilingRandomize"] = 3] = "CeilingRandomize";
|
42
|
+
})(CeilingPricingMethod || (exports.CeilingPricingMethod = CeilingPricingMethod = {}));
|
43
|
+
var NoCompPricingMethod;
|
44
|
+
(function (NoCompPricingMethod) {
|
45
|
+
NoCompPricingMethod[NoCompPricingMethod["Standard"] = 0] = "Standard";
|
46
|
+
NoCompPricingMethod[NoCompPricingMethod["Variable"] = 1] = "Variable";
|
47
|
+
NoCompPricingMethod[NoCompPricingMethod["Ceiling"] = 2] = "Ceiling";
|
48
|
+
NoCompPricingMethod[NoCompPricingMethod["FreezePricing"] = 3] = "FreezePricing";
|
49
|
+
NoCompPricingMethod[NoCompPricingMethod["UseFloorForAnchor"] = 4] = "UseFloorForAnchor";
|
50
|
+
NoCompPricingMethod[NoCompPricingMethod["UseCeilingForAnchor"] = 5] = "UseCeilingForAnchor";
|
51
|
+
NoCompPricingMethod[NoCompPricingMethod["UseCeiling"] = 6] = "UseCeiling";
|
52
|
+
NoCompPricingMethod[NoCompPricingMethod["CeilingRandomize"] = 7] = "CeilingRandomize";
|
53
|
+
})(NoCompPricingMethod || (exports.NoCompPricingMethod = NoCompPricingMethod = {}));
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
@@ -12,6 +12,8 @@ import {
|
|
12
12
|
import { McpTool } from "./types/tool";
|
13
13
|
import { GetProductionsTool } from "./tools/getProductions";
|
14
14
|
import { GetProductionInventoryTool } from "./tools/getProductionInventory";
|
15
|
+
import { GetPricingGroupsTool } from "./tools/getPricingGroups";
|
16
|
+
import { CreatePricingGroupTool } from "./tools/createPricingGroup";
|
15
17
|
|
16
18
|
class PrqxMcpServer{
|
17
19
|
private server: Server;
|
@@ -40,6 +42,8 @@ import { GetProductionInventoryTool } from "./tools/getProductionInventory";
|
|
40
42
|
|
41
43
|
this.tools.push(new GetProductionsTool());
|
42
44
|
this.tools.push(new GetProductionInventoryTool());
|
45
|
+
this.tools.push(new GetPricingGroupsTool());
|
46
|
+
this.tools.push(new CreatePricingGroupTool());
|
43
47
|
this.setupToolHandlers();
|
44
48
|
|
45
49
|
this.server.onerror = (error) => {
|
@@ -0,0 +1,174 @@
|
|
1
|
+
import { McpTool } from "../types/tool";
|
2
|
+
import { CallToolRequest, ErrorCode, McpError } from "@modelcontextprotocol/sdk/types.js";
|
3
|
+
import axios from "axios";
|
4
|
+
import { CeilingPricingMethod, CustomSharingMethod, FloorPricingMethod, NoCompPricingMethod, PricingGroupRequest, PricingGroupRequestType, PricingGroupResponse, ShareOptionsType, TicketGroupRequestRank } from "../types/pricingGroup";
|
5
|
+
|
6
|
+
export class CreatePricingGroupTool implements McpTool {
|
7
|
+
name = 'CreatePricingGroup';
|
8
|
+
description = 'Create a new pricing group';
|
9
|
+
inputSchema = {
|
10
|
+
type: 'object',
|
11
|
+
properties: {
|
12
|
+
productionId: {
|
13
|
+
type: 'number',
|
14
|
+
description: 'ID of the production that the pricing group will be created for'
|
15
|
+
},
|
16
|
+
name: {
|
17
|
+
type: 'string',
|
18
|
+
description: 'Name of the pricing group'
|
19
|
+
},
|
20
|
+
ceilingPrice: {
|
21
|
+
type: 'number',
|
22
|
+
description: 'Maximum price that the pricing group tickets can have'
|
23
|
+
},
|
24
|
+
floorPrice: {
|
25
|
+
type: 'number',
|
26
|
+
description: 'Minimum price that the pricing group tickets can have'
|
27
|
+
},
|
28
|
+
pricingGroupMode: {
|
29
|
+
type: 'string',
|
30
|
+
description: '(AutoPrice or SimulationOnly) Mode of the pricing group'
|
31
|
+
},
|
32
|
+
amount: {
|
33
|
+
type: 'number',
|
34
|
+
description: 'Amount used to price the anchor ticket of the pricing group based on the first market comparable'
|
35
|
+
},
|
36
|
+
increment:{
|
37
|
+
type: 'string',
|
38
|
+
description: '(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'
|
39
|
+
},
|
40
|
+
incrementMethod: {
|
41
|
+
type: 'string',
|
42
|
+
description: '( % or $ ) Decides if the amount is applied as a percentage or a dollar amount'
|
43
|
+
},
|
44
|
+
offsetAmount: {
|
45
|
+
type: 'number',
|
46
|
+
description: 'Offset amount used to price the other tickets in the group based of the previously ranked ticket'
|
47
|
+
},
|
48
|
+
offsetIncrement: {
|
49
|
+
type: 'string',
|
50
|
+
description: '(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'
|
51
|
+
},
|
52
|
+
offsetIncrementMethod: {
|
53
|
+
type: 'string',
|
54
|
+
description: '( % or $ ) Decides if the offset amount is applied as a percentage or a dollar amount'
|
55
|
+
},
|
56
|
+
enableShareOptions: {
|
57
|
+
type: 'boolean',
|
58
|
+
description: 'Decides if the pricing group will control the sharing of tickets in a marketplace or not'
|
59
|
+
},
|
60
|
+
shareOptionsType: {
|
61
|
+
type: 'string',
|
62
|
+
description: '(custom or all) Decides if we use custom parameters to share the tickets in the group or if we share them all'
|
63
|
+
},
|
64
|
+
shareAnchor: {
|
65
|
+
type: 'number',
|
66
|
+
description: 'Controls if the anchor ticket of the pricing group will be shared'
|
67
|
+
},
|
68
|
+
customSharingAmount: {
|
69
|
+
type: 'number',
|
70
|
+
description: 'Custom sharing amount use to determine which tickets to share of this pricing group'
|
71
|
+
},
|
72
|
+
customSharingMethod: {
|
73
|
+
type: 'string',
|
74
|
+
description: '( % or $ ) Decides if the custom sharing amount is applied as a percentage or a dollar amount'
|
75
|
+
},
|
76
|
+
applyCeilingOnlyToAnchor: {
|
77
|
+
type: 'boolean',
|
78
|
+
description: 'Decides if the ceiling price will be applied only to the anchor ticket of the pricing group'
|
79
|
+
},
|
80
|
+
applyFloorOnlyToAnchor: {
|
81
|
+
type: 'boolean',
|
82
|
+
description: 'Decides if the floor price will be applied only to the anchor ticket of the pricing group'
|
83
|
+
},
|
84
|
+
floorPricingMethod: {
|
85
|
+
type: 'string',
|
86
|
+
description: '(standard, variable, useFloor or floorRandomize) Decides what method to apply for pricing when the market comparable for the pricing group hits the floor price'
|
87
|
+
},
|
88
|
+
ceilingPricingMethod: {
|
89
|
+
type: 'string',
|
90
|
+
description: '(standard, variable, useCeiling or ceilingRandomize) Decides what method to apply for pricing when the market comparable for the pricing group hits the ceiling price'
|
91
|
+
},
|
92
|
+
noCompPricingMethod: {
|
93
|
+
type: 'string',
|
94
|
+
description: '(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'
|
95
|
+
},
|
96
|
+
pricingGroupRequestRanks: {
|
97
|
+
type: 'array',
|
98
|
+
description: 'Array of objects containing pricing group request ranks starting at 0 (anchor ticket). i.e [{"ticketGroupId": 1, "rank": 0},...]'
|
99
|
+
}
|
100
|
+
},
|
101
|
+
mandatory: ['productionId', 'name', 'ceilingPrice', 'floorPrice', 'pricingGroupMode', 'amount', 'increment', 'incrementMethod', 'pricingGroupRequestRanks']
|
102
|
+
};
|
103
|
+
toolHandler = async (request: CallToolRequest, httpClient: axios.AxiosInstance) => {
|
104
|
+
try{
|
105
|
+
if (!request?.params?.arguments) {
|
106
|
+
throw new Error('Missing arguments');
|
107
|
+
}
|
108
|
+
|
109
|
+
const productionId = request.params.arguments.productionId as number;
|
110
|
+
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;
|
113
|
+
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 number | 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[];
|
131
|
+
|
132
|
+
const args : PricingGroupRequest = {
|
133
|
+
productionId: productionId,
|
134
|
+
name: name,
|
135
|
+
ceilingPrice: ceilingPrice,
|
136
|
+
floorPrice: floorPrice,
|
137
|
+
pricingGroupRequestType: pricingGroupRequestType,
|
138
|
+
ruleSet: {
|
139
|
+
amount: amount,
|
140
|
+
increment: increment,
|
141
|
+
incrementMethod: incrementMethod,
|
142
|
+
offsetAmount: offsetAmount,
|
143
|
+
offsetIncrement: offsetIncrement,
|
144
|
+
offsetIncrementMethod: offsetIncrementMethod,
|
145
|
+
enableShareOptions: enableShareOptions,
|
146
|
+
shareOptionsType: shareOptionsType,
|
147
|
+
shareAnchor: shareAnchor,
|
148
|
+
customSharingAmount: customSharingAmount,
|
149
|
+
customSharingMethod: customSharingMethod,
|
150
|
+
applyCeilingOnlyToAnchor: applyCeilingOnlyToAnchor,
|
151
|
+
applyFloorOnlyToAnchor: applyFloorOnlyToAnchor,
|
152
|
+
floorPricingMethod: floorPricingMethod,
|
153
|
+
ceilingPricingMethod: ceilingPricingMethod,
|
154
|
+
noCompPricingMethod: noCompPricingMethod
|
155
|
+
},
|
156
|
+
marketGroupCriteria: {},
|
157
|
+
pricingGroupRequestRanks: pricingGroupRequestRanks
|
158
|
+
};
|
159
|
+
console.error('[API] Create Pricing Group with arguments:', args);
|
160
|
+
const response = await httpClient.post<PricingGroupResponse>(`/v2/client/pricing-group`, args);
|
161
|
+
if (response.status !== 200) {
|
162
|
+
throw new Error(`API error: ${response.statusText}`);
|
163
|
+
}
|
164
|
+
return { content: [{ type: 'text', text: JSON.stringify(response.data) }] };
|
165
|
+
} catch (error) {
|
166
|
+
if (error instanceof Error) {
|
167
|
+
console.error('Error in Create Pricing Group:', error);
|
168
|
+
throw new McpError(ErrorCode.InternalError, `Failed to create pricing group: ${error.message}`);
|
169
|
+
}
|
170
|
+
throw error;
|
171
|
+
}
|
172
|
+
};
|
173
|
+
}
|
174
|
+
|
@@ -0,0 +1,37 @@
|
|
1
|
+
import { CallToolRequest } from "@modelcontextprotocol/sdk/types.js";
|
2
|
+
import { ErrorCode, McpError } from "@modelcontextprotocol/sdk/types.js";
|
3
|
+
import { AxiosInstance } from "axios";
|
4
|
+
import { McpTool } from "../types/tool";
|
5
|
+
import { GetPricingGroupByProductionIdResponse } from "../types/pricingGroup";
|
6
|
+
|
7
|
+
export class GetPricingGroupsTool implements McpTool {
|
8
|
+
name = 'GetPricingGroups';
|
9
|
+
description = 'Get the organization pricing groups for a single production';
|
10
|
+
inputSchema = {
|
11
|
+
type: 'object',
|
12
|
+
properties: {
|
13
|
+
productionId: {
|
14
|
+
type: 'number',
|
15
|
+
description: 'ID of the production'
|
16
|
+
}
|
17
|
+
},
|
18
|
+
mandatory: ['productionId']
|
19
|
+
};
|
20
|
+
toolHandler = async (request: CallToolRequest, httpClient: AxiosInstance) => {
|
21
|
+
try {
|
22
|
+
const args = request.params.arguments as { productionId: number };
|
23
|
+
console.error('[API] Get Pricing Groups with arguments:', args);
|
24
|
+
const response = await httpClient.get<GetPricingGroupByProductionIdResponse>(`/v2/client/pricing-group/production/${args.productionId}`);
|
25
|
+
if (response.status !== 200) {
|
26
|
+
throw new Error(`API error: ${response.statusText}`);
|
27
|
+
}
|
28
|
+
return { content: [{ type: 'text', text: JSON.stringify(response.data) }] };
|
29
|
+
} catch (error) {
|
30
|
+
if (error instanceof Error) {
|
31
|
+
console.error('Error in Get Pricing Groups:', error);
|
32
|
+
throw new McpError(ErrorCode.InternalError, `Failed to fetch data: ${error.message}`);
|
33
|
+
}
|
34
|
+
throw error;
|
35
|
+
}
|
36
|
+
};
|
37
|
+
}
|
@@ -0,0 +1,148 @@
|
|
1
|
+
// TypeScript interfaces for /v2/client/pricing-group/production/{ProductionId} response
|
2
|
+
// Generated based on OpenAPI pricer.json
|
3
|
+
|
4
|
+
export interface PricingGroupResponse {
|
5
|
+
id: number;
|
6
|
+
name?: string | null;
|
7
|
+
ceilingPrice?: number | null;
|
8
|
+
floorPrice: number;
|
9
|
+
retailCeilingPrice?: number | null;
|
10
|
+
retailFloorPrice?: number | null;
|
11
|
+
ruleSet: RuleDto;
|
12
|
+
marketGroupCriteria: MarketCriteriaDto;
|
13
|
+
dynamicMarketGroupCriteria: DynamicMarketGroupCriteriaDto;
|
14
|
+
pricingGroupTickets?: PricingGroupTicketsResult[] | null;
|
15
|
+
isAutoPricingEnabled: boolean;
|
16
|
+
}
|
17
|
+
|
18
|
+
export enum LowerOutlierMethod{
|
19
|
+
Quantity,
|
20
|
+
Currency,
|
21
|
+
Percentage,
|
22
|
+
PercentThresholdOfPosition,
|
23
|
+
CurrencyThresholdOfPosition
|
24
|
+
}
|
25
|
+
|
26
|
+
export interface RowRange {
|
27
|
+
startRow: number;
|
28
|
+
endRow: number;
|
29
|
+
}
|
30
|
+
|
31
|
+
export interface MarketCriteriaDto {
|
32
|
+
sections?: SectionDto[];
|
33
|
+
validSplitsIncludeV2?: number[];
|
34
|
+
validSplitsIncludeMax?: boolean;
|
35
|
+
deliveryMethodInclude?: string[];
|
36
|
+
attributesExclude?: string[];
|
37
|
+
lowerOutlierMethod?: LowerOutlierMethod;
|
38
|
+
lowerOutlierAmount?: number;
|
39
|
+
lowerOutlierThreshold?: number;
|
40
|
+
includeSpeculativeTickets?: boolean;
|
41
|
+
isSplitsDynamic?: boolean;
|
42
|
+
rowRanges?: RowRange[];
|
43
|
+
}
|
44
|
+
|
45
|
+
export interface SectionDto {
|
46
|
+
sectionName?: string;
|
47
|
+
sectionKey?: string;
|
48
|
+
rowRanges?: RowRange[];
|
49
|
+
}
|
50
|
+
|
51
|
+
export interface DynamicMarketGroupCriteriaDto {
|
52
|
+
validSplitsV2: ValidSplits;
|
53
|
+
}
|
54
|
+
|
55
|
+
export interface ValidSplits {
|
56
|
+
splits?: number[] | null;
|
57
|
+
includeMax: boolean;
|
58
|
+
}
|
59
|
+
|
60
|
+
export interface PricingGroupTicketsResult {
|
61
|
+
ticketGroupId: number;
|
62
|
+
rank?: number | null;
|
63
|
+
listPrice?: number | null;
|
64
|
+
retailPrice?: number | null;
|
65
|
+
isShared?: boolean | null;
|
66
|
+
isFloorHit: boolean;
|
67
|
+
isCeilingHit: boolean;
|
68
|
+
isNoActiveCompHit: boolean;
|
69
|
+
}
|
70
|
+
|
71
|
+
export enum PricingGroupRequestType{
|
72
|
+
AutoPrice,
|
73
|
+
SimulationOnly
|
74
|
+
}
|
75
|
+
|
76
|
+
export interface RuleDto{
|
77
|
+
increment?: string;
|
78
|
+
incrementMethod?: string;
|
79
|
+
amount: number;
|
80
|
+
offsetIncrement?: string;
|
81
|
+
offsetIncrementMethod?: string;
|
82
|
+
offsetAmount?: number;
|
83
|
+
enableShareOptions?: boolean;
|
84
|
+
shareOptionsType?: ShareOptionsType;
|
85
|
+
shareAnchor?: number;
|
86
|
+
floorPricingMethod?: FloorPricingMethod;
|
87
|
+
ceilingPricingMethod?: CeilingPricingMethod;
|
88
|
+
noCompPricingMethod?: NoCompPricingMethod;
|
89
|
+
customSharingAmount?: number;
|
90
|
+
customSharingMethod?: CustomSharingMethod;
|
91
|
+
applyCeilingOnlyToAnchor?: boolean;
|
92
|
+
applyFloorOnlyToAnchor?: boolean;
|
93
|
+
}
|
94
|
+
|
95
|
+
export enum CustomSharingMethod{
|
96
|
+
Percentage = "%",
|
97
|
+
Currency = "$"
|
98
|
+
}
|
99
|
+
|
100
|
+
export enum ShareOptionsType{
|
101
|
+
Custom,
|
102
|
+
All
|
103
|
+
}
|
104
|
+
|
105
|
+
export enum FloorPricingMethod{
|
106
|
+
Standard,
|
107
|
+
Variable,
|
108
|
+
UseFloor,
|
109
|
+
FloorRandomize
|
110
|
+
}
|
111
|
+
|
112
|
+
export enum CeilingPricingMethod{
|
113
|
+
Standard,
|
114
|
+
Variable,
|
115
|
+
UseCeiling,
|
116
|
+
CeilingRandomize
|
117
|
+
}
|
118
|
+
|
119
|
+
export enum NoCompPricingMethod{
|
120
|
+
Standard,
|
121
|
+
Variable,
|
122
|
+
Ceiling,
|
123
|
+
FreezePricing,
|
124
|
+
UseFloorForAnchor,
|
125
|
+
UseCeilingForAnchor,
|
126
|
+
UseCeiling,
|
127
|
+
CeilingRandomize
|
128
|
+
}
|
129
|
+
|
130
|
+
export interface PricingGroupRequest{
|
131
|
+
name?: string;
|
132
|
+
ceilingPrice?: number;
|
133
|
+
floorPrice?: number;
|
134
|
+
pricingGroupRequestType?: PricingGroupRequestType;
|
135
|
+
pricingGroupRequestRanks: TicketGroupRequestRank[];
|
136
|
+
ruleSet: RuleDto;
|
137
|
+
marketGroupCriteria: MarketCriteriaDto;
|
138
|
+
productionId: number;
|
139
|
+
pricingTemplateId?: number;
|
140
|
+
}
|
141
|
+
|
142
|
+
export interface TicketGroupRequestRank{
|
143
|
+
ticketGroupId: number;
|
144
|
+
rank: number;
|
145
|
+
}
|
146
|
+
|
147
|
+
// The response for the endpoint is an array of PricingGroupResponse
|
148
|
+
export type GetPricingGroupByProductionIdResponse = PricingGroupResponse[];
|