@airwallex/developer-mcp
Version:
MCP server for AI agents that assist developers integrating with the Airwallex platform
50 lines (49 loc) • 1.86 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.createBillingProductToolConfig = exports.createBillingProductSchema = void 0;
exports.executeCreateBillingProduct = executeCreateBillingProduct;
const uuid_1 = require("uuid");
const zod_1 = require("zod");
const descriptions_1 = require("../constants/descriptions");
exports.createBillingProductSchema = zod_1.z.object({
description: zod_1.z.string().optional(),
name: zod_1.z.string().min(1, "Product name is required"),
request_id: zod_1.z
.string()
.min(1)
.optional()
.describe("Optional idempotency key. If not provided, one will be generated automatically"),
});
async function executeCreateBillingProduct(airwallex, args) {
try {
const requestId = args.request_id || (0, uuid_1.v4)();
const response = (await airwallex.post("/api/v1/products/create", {
name: args.name,
request_id: requestId,
...(args.description && { description: args.description }),
}));
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 create billing product (${statusCode}): ${errorMessage}`);
}
}
exports.createBillingProductToolConfig = {
annotations: {
openWorldHint: true,
readOnlyHint: false,
title: "Create billing product",
},
description: descriptions_1.TOOL_DESCRIPTIONS.CREATE_BILLING_PRODUCT,
inputSchema: exports.createBillingProductSchema,
name: "create_billing_product",
};