forex_exchangeRates
Get real-time exchange rates for currency pairs to calculate conversion values for international transactions or financial analysis.
Instructions
Fetches the realtime exchange rate for a currency pair (e.g., EUR to USD).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| from_currency | Yes | The currency symbol to convert from (e.g., "EUR"). | |
| to_currency | Yes | The currency symbol to convert to (e.g., "USD"). |
Implementation Reference
- src/index.ts:709-721 (handler)The handler and registration for the 'forex_exchangeRates' tool. The execute function calls executeAvantageTool, which invokes the Alpha Vantage forex.exchangeRates API with from_currency and to_currency parameters.server.addTool({ name: "forex_exchangeRates", description: "Fetches the realtime exchange rate for a currency pair (e.g., EUR to USD).", parameters: schemas.ForexExchangeRateParamsSchema, execute: ( args, context // Let type be inferred ) => executeAvantageTool("forex_exchangeRates", args, context, (av, params) => av.forex.exchangeRates(params.from_currency, params.to_currency) ), });
- src/schemas.ts:145-149 (schema)Zod schema defining input parameters for the forex_exchangeRates tool: from_currency and to_currency.export const ForexExchangeRateParamsSchema = z.object({ from_currency: z.string().describe('The currency symbol to convert from (e.g., "EUR").'), to_currency: z.string().describe('The currency symbol to convert to (e.g., "USD").'), }).describe('Parameters for fetching Forex exchange rates.')