get_currency_rates
Retrieve current currency exchange rates from Monobank API to support financial calculations and international transactions.
Instructions
Get a basic list of currency rates from Monobank. The information can be refreshed once per 5 minutes, otherwise an error will be thrown.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:22-39 (handler)The implementation of the get_currency_rates tool, including registration and the async handler function that fetches and processes the currency data.
server.tool( "get_currency_rates", "Get a basic list of currency rates from Monobank. The information can be refreshed once per 5 minutes, otherwise an error will be thrown.", {}, async () => { try { const { baseUrl } = getConfig(); const response = await fetchWithErrorHandling( `${baseUrl}/bank/currency`, ); const result = await parseJsonResponse<CurrencyRate[]>(response); const currencyRates = CurrencyRatesResponseSchema.parse(result); return createSuccessResponse(currencyRates); } catch (error) { return formatErrorAsToolResponse(error, "get currency rates"); } }, );