finance_forex_rate
Retrieve foreign exchange rates between currency pairs with 5-day historical data to support financial analysis and currency conversion decisions.
Instructions
Get foreign exchange rate between two currencies with 5-day history. Costs $0.01 USDC per request via x402 on Base. Format: FROM-TO (e.g., USD-EUR, GBP-JPY, EUR-INR)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pair | Yes | Currency pair in FROM-TO format (e.g., USD-EUR, GBP-JPY) |
Implementation Reference
- src/index.ts:195-211 (handler)The tool "finance_forex_rate" is registered here with its schema and handler implementation. It uses a helper 'apiFetch' to call a finance API endpoint.
server.registerTool( "finance_forex_rate", { title: "Get Forex Rate", description: `Get foreign exchange rate between two currencies with 5-day history. Costs $0.01 USDC per request via x402 on Base. Format: FROM-TO (e.g., USD-EUR, GBP-JPY, EUR-INR)`, inputSchema: { pair: z.string().min(5).max(10).describe("Currency pair in FROM-TO format (e.g., USD-EUR, GBP-JPY)"), }, annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true }, }, async ({ pair }) => { const data = await apiFetch(`${FINANCE_API}/api/v1/forex/rate/${pair.toUpperCase()}`); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; } );