mcp-prqx-pricer 1.0.6 → 1.0.7

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 CHANGED
@@ -12,6 +12,7 @@ const getProductions_1 = require("./tools/getProductions");
12
12
  const getProductionInventory_1 = require("./tools/getProductionInventory");
13
13
  const getPricingGroups_1 = require("./tools/getPricingGroups");
14
14
  const createPricingGroup_1 = require("./tools/createPricingGroup");
15
+ const deletePricingGroups_1 = require("./tools/deletePricingGroups");
15
16
  class PrqxMcpServer {
16
17
  server;
17
18
  axiosInstance;
@@ -37,6 +38,7 @@ class PrqxMcpServer {
37
38
  this.tools.push(new getProductionInventory_1.GetProductionInventoryTool());
38
39
  this.tools.push(new getPricingGroups_1.GetPricingGroupsTool());
39
40
  this.tools.push(new createPricingGroup_1.CreatePricingGroupTool());
41
+ this.tools.push(new deletePricingGroups_1.DeletePricingGroupsTool());
40
42
  this.setupToolHandlers();
41
43
  this.server.onerror = (error) => {
42
44
  console.error('[Error] MCP server error:', error);
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeletePricingGroupsTool = void 0;
4
+ const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
5
+ class DeletePricingGroupsTool {
6
+ name = 'DeletePricingGroups';
7
+ description = 'Delete multiple pricing groups in bulk';
8
+ inputSchema = {
9
+ type: 'object',
10
+ properties: {
11
+ pricingGroupIds: {
12
+ type: 'array',
13
+ description: 'Array of IDs (numbers) of the pricing groups that will be deleted. They can belong to multiple productions.'
14
+ }
15
+ },
16
+ required: ['pricingGroupIds']
17
+ };
18
+ async toolHandler(request, axiosInstance) {
19
+ try {
20
+ const args = request.params.arguments;
21
+ if (!args) {
22
+ throw new Error('Missing argument pricingGroupIds');
23
+ }
24
+ console.error('[API] Delete Pricing Group with arguments:', args);
25
+ const response = await axiosInstance.delete(`/v2/client/pricing-group/bulk`, { data: args });
26
+ return { content: [{ type: 'text', text: 'Operation Completed!' }] };
27
+ }
28
+ catch (error) {
29
+ if (error instanceof Error) {
30
+ console.error('Error in Delete Pricing Groups:', error);
31
+ throw new types_js_1.McpError(types_js_1.ErrorCode.InternalError, `Failed to delete pricing groups: ${error.message}`);
32
+ }
33
+ throw error;
34
+ }
35
+ }
36
+ }
37
+ exports.DeletePricingGroupsTool = DeletePricingGroupsTool;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-prqx-pricer",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
package/src/index.ts CHANGED
@@ -8,12 +8,13 @@ import {
8
8
  ListToolsRequestSchema,
9
9
  McpError,
10
10
  } from '@modelcontextprotocol/sdk/types.js';
11
- import axios from 'axios';
11
+ import axios from 'axios';
12
12
  import { McpTool } from "./types/tool";
13
13
  import { GetProductionsTool } from "./tools/getProductions";
14
14
  import { GetProductionInventoryTool } from "./tools/getProductionInventory";
15
15
  import { GetPricingGroupsTool } from "./tools/getPricingGroups";
16
16
  import { CreatePricingGroupTool } from "./tools/createPricingGroup";
17
+ import { DeletePricingGroupsTool } from "./tools/deletePricingGroups";
17
18
 
18
19
  class PrqxMcpServer{
19
20
  private server: Server;
@@ -44,8 +45,8 @@ import { CreatePricingGroupTool } from "./tools/createPricingGroup";
44
45
  this.tools.push(new GetProductionInventoryTool());
45
46
  this.tools.push(new GetPricingGroupsTool());
46
47
  this.tools.push(new CreatePricingGroupTool());
48
+ this.tools.push(new DeletePricingGroupsTool());
47
49
  this.setupToolHandlers();
48
-
49
50
  this.server.onerror = (error) => {
50
51
  console.error('[Error] MCP server error:', error);
51
52
  };
@@ -0,0 +1,36 @@
1
+ import { CallToolRequest, ErrorCode, McpError } from "@modelcontextprotocol/sdk/types.js";
2
+ import { AxiosInstance } from "axios";
3
+ import { McpTool } from "../types/tool";
4
+
5
+ export class DeletePricingGroupsTool implements McpTool {
6
+ name = 'DeletePricingGroups';
7
+ description = 'Delete multiple pricing groups in bulk';
8
+ inputSchema = {
9
+ type: 'object',
10
+ properties: {
11
+ pricingGroupIds: {
12
+ type: 'array',
13
+ description: 'Array of IDs (numbers) of the pricing groups that will be deleted. They can belong to multiple productions.'
14
+ }
15
+ },
16
+ required: ['pricingGroupIds']
17
+ };
18
+
19
+ async toolHandler(request: CallToolRequest, axiosInstance: AxiosInstance): Promise<any> {
20
+ try{
21
+ const args = request.params.arguments as { pricingGroupIds: [number] };
22
+ if (!args) {
23
+ throw new Error('Missing argument pricingGroupIds');
24
+ }
25
+ console.error('[API] Delete Pricing Group with arguments:', args);
26
+ const response = await axiosInstance.delete(`/v2/client/pricing-group/bulk`, {data: args});
27
+ return { content: [{ type: 'text', text: 'Operation Completed!' }] };
28
+ } catch (error) {
29
+ if (error instanceof Error) {
30
+ console.error('Error in Delete Pricing Groups:', error);
31
+ throw new McpError(ErrorCode.InternalError, `Failed to delete pricing groups: ${error.message}`);
32
+ }
33
+ throw error;
34
+ }
35
+ }
36
+ }