UNPKG

@airwallex/developer-mcp

Version:

MCP server for AI agents that assist developers integrating with the Airwallex platform

47 lines (46 loc) 1.7 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.listBillingPricesToolConfig = exports.listBillingPricesSchema = void 0; exports.executeListBillingPrices = executeListBillingPrices; const zod_1 = require("zod"); const descriptions_1 = require("../constants/descriptions"); exports.listBillingPricesSchema = zod_1.z.object({ product_id: zod_1.z .string() .optional() .describe("Optional product ID to filter prices by"), }); async function executeListBillingPrices(airwallex, args) { try { const queryParams = new URLSearchParams(); if (args.product_id) { queryParams.append("product_id", args.product_id); } queryParams.append("page_size", "100"); const url = `/api/v1/prices${queryParams.toString() ? `?${queryParams.toString()}` : ""}`; const response = (await airwallex.get(url)); return { content: [ { text: JSON.stringify(response, null, 2), type: "text", }, ], }; } catch (error) { const statusCode = error?.status || error?.statusCode || 500; const errorMessage = error?.message || "Unknown error occurred"; throw new Error(`Failed to list billing prices (${statusCode}): ${errorMessage}`); } } exports.listBillingPricesToolConfig = { annotations: { openWorldHint: true, readOnlyHint: true, title: "List billing prices", }, description: descriptions_1.TOOL_DESCRIPTIONS.LIST_BILLING_PRICES, inputSchema: exports.listBillingPricesSchema, name: "list_billing_prices", };