get_all_dollars
Retrieve Argentine dollar exchange rates including blue, oficial, MEP, CCL, crypto, and other types with buy/sell prices for financial analysis.
Instructions
Get all Argentine dollar exchange rates: blue, oficial, bolsa (MEP), contado con liqui (CCL), cripto, mayorista, and tarjeta. Returns buy/sell prices.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/actions.ts:22-24 (handler)The getAllDollars handler function that executes the tool logic by fetching all dollar exchange rates from the API endpoint '/v1/dolares' and returning them as a DollarRate[] array.
export async function getAllDollars(client: DolarApiClient): Promise<unknown> { return client.get<DollarRate[]>("/v1/dolares"); } - src/actions.ts:4-11 (schema)The DollarRate interface that defines the structure of each dollar exchange rate object returned by the get_all_dollars tool, including currency, house name, buy/sell prices, and update timestamp.
interface DollarRate { moneda: string; casa: string; nombre: string; compra: number; venta: number; fechaActualizacion: string; } - src/mcp-server.ts:13-26 (registration)The MCP tool registration for 'get_all_dollars' with description, empty input schema (no parameters required), and the async handler that calls tools.get_all_dollars() and formats the JSON response.
server.tool( "get_all_dollars", "Get all Argentine dollar exchange rates: blue, oficial, bolsa (MEP), contado con liqui (CCL), cripto, mayorista, and tarjeta. Returns buy/sell prices.", {}, async () => { try { const result = await tools.get_all_dollars(); 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 factory function that creates a DolarApiClient instance and returns a tools object with get_all_dollars wrapper function that calls getAllDollars(client) with the injected client dependency.
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:3-16 (helper)The DolarApiClient class with a generic get() method that performs HTTP GET requests to the dolarapi.com API with timeout and error handling, used by getAllDollars to fetch the dollar rates.
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>; } }