Skip to main content
Glama
dan1d

dolar-mcp

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
NameRequiredDescriptionDefault
currencyYesCurrency code: EUR, BRL, UYU, CLP, COP, PEN, MXN, etc.

Implementation Reference

  • 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)}`);
    }
  • TypeScript interface defining the input parameters for get_currency tool - requires a currency code string.
    export interface GetCurrencyParams {
      currency: string;
    }
  • 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),

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