Skip to main content
Glama
dan1d

mercadolibre-mcp

get_currency_conversion

Convert currencies using MercadoLibre exchange rates for ARS, BRL, MXN, USD, and other currencies. Input source, target, and optional amount to get the converted value.

Instructions

Convert between currencies using MercadoLibre exchange rates (ARS, BRL, MXN, USD, etc.).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fromYesSource currency code (e.g. USD)
toYesTarget currency code (e.g. ARS)
amountNoAmount to convert (default: 1)

Implementation Reference

  • The actual handler function `getCurrencyConversion` that executes the currency conversion logic. It calls the MercadoLibre API at `/currency_conversions/search` with `from` and `to` parameters, then returns the conversion result including the rate, original amount, and converted amount.
    export async function getCurrencyConversion(
      client: MercadoLibreClient,
      params: GetCurrencyConversionParams
    ): Promise<unknown> {
      const result = await client.get<{ ratio: number }>(
        `/currency_conversions/search`,
        { from: params.from, to: params.to }
      );
      const amount = params.amount ?? 1;
      return {
        from: params.from,
        to: params.to,
        rate: result.ratio,
        amount,
        converted: Number((amount * result.ratio).toFixed(4)),
      };
    }
  • TypeScript interface `GetCurrencyConversionParams` defining the input parameters: `from` (source currency), `to` (target currency), and optional `amount`.
    export interface GetCurrencyConversionParams {
      from: string;
      to: string;
      amount?: number;
    }
  • Registration of the `get_currency_conversion` tool in the MCP server using `server.tool()`. It defines the Zod schema for params (from, to, amount) and the handler that delegates to `tools.get_currency_conversion`.
    server.tool(
      "get_currency_conversion",
      "Convert between currencies using MercadoLibre exchange rates (ARS, BRL, MXN, USD, etc.).",
      {
        from: z.string().describe("Source currency code (e.g. USD)"),
        to: z.string().describe("Target currency code (e.g. ARS)"),
        amount: z.number().optional().describe("Amount to convert (default: 1)"),
      },
      async (params) => {
        try {
          const result = await tools.get_currency_conversion(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:35-36 (registration)
    Tool registration in `createMercadoLibreTools`: maps the string key `get_currency_conversion` to a lambda that calls `getCurrencyConversion(client, params)`.
      get_currency_conversion: (params: GetCurrencyConversionParams) => getCurrencyConversion(client, params),
    },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must disclose behavioral traits. It mentions using 'MercadoLibre exchange rates' but does not specify whether rates are real-time or historical, if there are any rounding rules, or if the conversion is reversible.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

One efficient sentence with no unnecessary words. It is front-loaded and immediately conveys the tool's purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

No output schema, so the description should indicate what is returned (e.g., converted amount, exchange rate). It also does not specify the full list of supported currencies or any error conditions. This is incomplete for a conversion tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100% (all parameters described). The description adds minimal extra value beyond the schema (example currency codes), but the schema already provides examples. Baseline of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool converts currencies using specific exchange rates from MercadoLibre, listing example currencies (ARS, BRL, MXN, USD). It is distinct from sibling tools which focus on categories, items, and searches.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool vs alternatives, nor any limitations or prerequisites. The description does not mention scenarios where it should not be used or if there are rate limits or supported currency restrictions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/mercadolibre-mcp'

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