@airwallex/developer-mcp
Version:
MCP server for AI agents that assist developers integrating with the Airwallex platform
55 lines (54 loc) • 1.95 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.simulateDepositToolConfig = exports.simulateDepositSchema = void 0;
exports.executeSimulateDeposit = executeSimulateDeposit;
const zod_1 = require("zod");
const descriptions_1 = require("../constants/descriptions");
exports.simulateDepositSchema = zod_1.z.object({
amount: zod_1.z
.number()
.positive()
.describe("The amount to deposit into the global account (in the account's base currency, not minor units)"),
globalAccountId: zod_1.z
.string()
.min(1)
.describe("The unique ID of the global account to deposit funds into"),
});
async function executeSimulateDeposit(airwallex, args) {
try {
const response = await airwallex.post("/api/v1/simulation/deposit/create", {
amount: args.amount,
global_account_id: args.globalAccountId,
});
const result = {
amount: response.amount,
created_at: response.create_time,
currency: response.currency,
deposit_id: response.id,
status: response.status,
};
return {
content: [
{
text: JSON.stringify(result, null, 2),
type: "text",
},
],
};
}
catch (error) {
const statusCode = error?.status || error?.statusCode || 500;
const errorMessage = error?.message || "Unknown error occurred";
throw new Error(`Deposit simulation failed (${statusCode}): ${errorMessage}`);
}
}
exports.simulateDepositToolConfig = {
annotations: {
openWorldHint: true,
readOnlyHint: false,
title: "Simulate global account deposit",
},
description: descriptions_1.TOOL_DESCRIPTIONS.SIMULATE_DEPOSIT,
inputSchema: exports.simulateDepositSchema,
name: "simulate_create_deposit",
};