Skip to main content
Glama
dan1d

dolar-mcp

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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");
    }
  • 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;
    }
  • 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 };
        }
      },
    );
  • 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),
        },
      };
    }
  • 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>;
      }
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/dan1d/dolar-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server