finance_forex_convert
Convert currency amounts using live forex rates with x402 USDC micropayments on Base.
Instructions
Convert an amount from one currency to another using live forex rates. Costs $0.02 USDC per request via x402 on Base.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| from | Yes | Source currency code (e.g., USD, EUR, GBP) | |
| to | Yes | Target currency code (e.g., INR, JPY, EUR) | |
| amount | Yes | Amount to convert |
Implementation Reference
- src/index.ts:213-230 (handler)Registration and handler implementation for the finance_forex_convert tool.
server.registerTool( "finance_forex_convert", { title: "Convert Currency", description: `Convert an amount from one currency to another using live forex rates. Costs $0.02 USDC per request via x402 on Base.`, inputSchema: { from: z.string().min(3).max(3).describe("Source currency code (e.g., USD, EUR, GBP)"), to: z.string().min(3).max(3).describe("Target currency code (e.g., INR, JPY, EUR)"), amount: z.number().positive().describe("Amount to convert"), }, annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true }, }, async ({ from, to, amount }) => { const data = await apiPost(`${FINANCE_API}/api/v1/forex/convert`, { from, to, amount }); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; } );