get_currency
Retrieve real-time exchange rates for foreign currencies against the Argentine peso (ARS) to support currency conversion and financial calculations.
Instructions
Get exchange rate for a specific foreign currency vs ARS.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| currency | Yes | Currency code: EUR, BRL, UYU, CLP, COP, PEN, MXN, etc. |
Implementation Reference
- src/actions.ts:37-42 (handler)The main handler function that implements get_currency logic. Takes a DolarApiClient and GetCurrencyParams, makes a GET request to /v1/cotizaciones/{currency} endpoint to fetch exchange rate for a specific foreign currency vs ARS.
export async function getCurrency( client: DolarApiClient, params: GetCurrencyParams ): Promise<unknown> { return client.get<CurrencyRate>(`/v1/cotizaciones/${encodeURIComponent(params.currency)}`); } - src/schemas.ts:5-7 (schema)TypeScript interface defining the input parameters for get_currency tool - requires a currency code string.
export interface GetCurrencyParams { currency: string; } - src/mcp-server.ts:60-75 (registration)MCP server registration of get_currency tool with Zod schema validation for the currency parameter and handler that returns JSON-formatted results.
server.tool( "get_currency", "Get exchange rate for a specific foreign currency vs ARS.", { currency: z.string().describe("Currency code: EUR, BRL, UYU, CLP, COP, PEN, MXN, etc."), }, async (params) => { try { const result = await tools.get_currency(params); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } catch (error) { const message = error instanceof Error ? error.message : String(error); return { content: [{ type: "text", text: message }], isError: true }; } }, ); - src/index.ts:25-25 (registration)Tool registration in the createDolarTools function, mapping get_currency to the getCurrency handler function.
get_currency: (params: GetCurrencyParams) => getCurrency(client, params),