get_all_currencies
Retrieve all foreign currency exchange rates against the Argentine Peso, including EUR, BRL, UYU, CLP, and more.
Instructions
Get all foreign currency exchange rates vs ARS (EUR, BRL, UYU, CLP, etc.).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/actions.ts:33-35 (handler)The actual handler function that executes the tool logic. Calls the DolarApi client's GET /v1/cotizaciones endpoint to fetch all foreign currency exchange rates vs ARS.
export async function getAllCurrencies(client: DolarApiClient): Promise<unknown> { return client.get<CurrencyRate[]>("/v1/cotizaciones"); } - src/schemas.ts:1-19 (schema)Schema definitions for tool parameters. get_all_currencies has no input params (empty object {}), so no specific schema is defined for it.
export interface GetDollarParams { type: string; } export interface GetCurrencyParams { currency: string; } export interface ConvertParams { amount: number; from: string; to?: string; use_buy?: boolean; } export interface GetSpreadParams { type_a: string; type_b: string; } - src/mcp-server.ts:45-58 (registration)MCP server registration of the 'get_all_currencies' tool. Defines its description, empty input schema, and the async handler that calls tools.get_all_currencies().
server.tool( "get_all_currencies", "Get all foreign currency exchange rates vs ARS (EUR, BRL, UYU, CLP, etc.).", {}, async () => { try { const result = await tools.get_all_currencies(); 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:17-30 (helper)The createDolarTools() function that wires the getAllCurrencies action to the 'get_all_currencies' tool name by passing a client instance.
export function createDolarTools() { const client = new DolarApiClient(); return { tools: { get_all_dollars: () => getAllDollars(client), get_dollar: (params: GetDollarParams) => getDollar(client, params), get_all_currencies: () => getAllCurrencies(client), get_currency: (params: GetCurrencyParams) => getCurrency(client, params), convert: (params: ConvertParams) => convert(client, params), get_spread: (params: GetSpreadParams) => getSpread(client, params), }, }; } - src/client.ts:1-16 (helper)The DolarApiClient class used by the handler to make HTTP GET requests to https://dolarapi.com/v1/cotizaciones.
const BASE_URL = "https://dolarapi.com"; export class DolarApiClient { async get<T = unknown>(path: string): Promise<T> { const res = await fetch(`${BASE_URL}${path}`, { method: "GET", headers: { "Content-Type": "application/json" }, signal: AbortSignal.timeout(15000), }); if (!res.ok) { const body = await res.text(); throw new Error(`GET ${path} failed (${res.status}): ${body}`); } return res.json() as Promise<T>; } }