mcp-prqx-pricer 1.0.4 → 1.0.5
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 +2 -0
- package/build/tools/getPricingGroups.js +37 -0
- package/build/types/pricingGroup.js +13 -0
- package/package.json +1 -1
- package/src/index.ts +2 -0
- package/src/tools/getPricingGroups.ts +37 -0
- package/src/types/pricingGroup.ts +81 -0
package/build/index.js
CHANGED
@@ -10,6 +10,7 @@ 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");
|
13
14
|
class PrqxMcpServer {
|
14
15
|
server;
|
15
16
|
axiosInstance;
|
@@ -33,6 +34,7 @@ class PrqxMcpServer {
|
|
33
34
|
});
|
34
35
|
this.tools.push(new getProductions_1.GetProductionsTool());
|
35
36
|
this.tools.push(new getProductionInventory_1.GetProductionInventoryTool());
|
37
|
+
this.tools.push(new getPricingGroups_1.GetPricingGroupsTool());
|
36
38
|
this.setupToolHandlers();
|
37
39
|
this.server.onerror = (error) => {
|
38
40
|
console.error('[Error] MCP server error:', error);
|
@@ -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,13 @@
|
|
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.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 = {}));
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
@@ -12,6 +12,7 @@ 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";
|
15
16
|
|
16
17
|
class PrqxMcpServer{
|
17
18
|
private server: Server;
|
@@ -40,6 +41,7 @@ import { GetProductionInventoryTool } from "./tools/getProductionInventory";
|
|
40
41
|
|
41
42
|
this.tools.push(new GetProductionsTool());
|
42
43
|
this.tools.push(new GetProductionInventoryTool());
|
44
|
+
this.tools.push(new GetPricingGroupsTool());
|
43
45
|
this.setupToolHandlers();
|
44
46
|
|
45
47
|
this.server.onerror = (error) => {
|
@@ -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,81 @@
|
|
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 interface RuleDto {
|
19
|
+
id: number;
|
20
|
+
organizationKey?: string | null;
|
21
|
+
name?: string | null;
|
22
|
+
ceilingPrice: number;
|
23
|
+
floorPrice: number;
|
24
|
+
isAutoPricingEnabled: boolean;
|
25
|
+
}
|
26
|
+
|
27
|
+
export enum LowerOutlierMethod{
|
28
|
+
Quantity,
|
29
|
+
Currency,
|
30
|
+
Percentage,
|
31
|
+
PercentThresholdOfPosition,
|
32
|
+
CurrencyThresholdOfPosition
|
33
|
+
}
|
34
|
+
|
35
|
+
export interface RowRange {
|
36
|
+
startRow: number;
|
37
|
+
endRow: number;
|
38
|
+
}
|
39
|
+
|
40
|
+
export interface MarketCriteriaDto {
|
41
|
+
sections?: SectionDto[];
|
42
|
+
validSplitsIncludeV2?: number[];
|
43
|
+
validSplitsIncludeMax?: boolean;
|
44
|
+
deliveryMethodInclude?: string[];
|
45
|
+
attributesExclude?: string[];
|
46
|
+
lowerOutlierMethod?: LowerOutlierMethod;
|
47
|
+
lowerOutlierAmount?: number;
|
48
|
+
lowerOutlierThreshold?: number;
|
49
|
+
includeSpeculativeTickets?: boolean;
|
50
|
+
isSplitsDynamic?: boolean;
|
51
|
+
rowRanges?: RowRange[];
|
52
|
+
}
|
53
|
+
|
54
|
+
export interface SectionDto {
|
55
|
+
sectionName?: string;
|
56
|
+
sectionKey?: string;
|
57
|
+
rowRanges?: RowRange[];
|
58
|
+
}
|
59
|
+
|
60
|
+
export interface DynamicMarketGroupCriteriaDto {
|
61
|
+
validSplitsV2: ValidSplits;
|
62
|
+
}
|
63
|
+
|
64
|
+
export interface ValidSplits {
|
65
|
+
splits?: number[] | null;
|
66
|
+
includeMax: boolean;
|
67
|
+
}
|
68
|
+
|
69
|
+
export interface PricingGroupTicketsResult {
|
70
|
+
ticketGroupId: number;
|
71
|
+
rank?: number | null;
|
72
|
+
listPrice?: number | null;
|
73
|
+
retailPrice?: number | null;
|
74
|
+
isShared?: boolean | null;
|
75
|
+
isFloorHit: boolean;
|
76
|
+
isCeilingHit: boolean;
|
77
|
+
isNoActiveCompHit: boolean;
|
78
|
+
}
|
79
|
+
|
80
|
+
// The response for the endpoint is an array of PricingGroupResponse
|
81
|
+
export type GetPricingGroupByProductionIdResponse = PricingGroupResponse[];
|