Skip to main content
Glama
UniRate-API

UniRate MCP

Official
by UniRate-API

Convert currency

convert
Read-only

Converts an amount from one currency to another using up-to-date exchange rates. Accepts ISO 4217 codes for 170+ fiat currencies and major cryptocurrencies.

Instructions

Convert an amount from one currency to another using the latest exchange rate. Codes are ISO 4217 (e.g. USD, EUR, GBP). Supports 170+ fiat currencies and major cryptocurrencies.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fromYesSource currency code, e.g. 'USD'
toYesTarget currency code, e.g. 'EUR'
amountYesAmount in the source currency

Implementation Reference

  • The tool handler function for 'convert'. Executes the conversion logic by calling client.convert() and returns the formatted result.
      async ({ from, to, amount }) => {
        try {
          const result = await client.convert(from, to, amount);
          return ok(
            `${amount} ${from.toUpperCase()} = ${result} ${to.toUpperCase()}`,
            { from: from.toUpperCase(), to: to.toUpperCase(), amount, result },
          );
        } catch (err) {
          return fail(err);
        }
      },
    );
  • Input schema and metadata for the 'convert' tool, defining 'from' (source currency), 'to' (target currency), and 'amount' parameters with Zod validation.
    {
      title: "Convert currency",
      description:
        "Convert an amount from one currency to another using the latest exchange rate. " +
        "Codes are ISO 4217 (e.g. USD, EUR, GBP). Supports 170+ fiat currencies and major cryptocurrencies.",
      inputSchema: {
        from: z.string().min(3).max(10).describe("Source currency code, e.g. 'USD'"),
        to: z.string().min(3).max(10).describe("Target currency code, e.g. 'EUR'"),
        amount: z.number().positive().describe("Amount in the source currency"),
      },
      annotations: { readOnlyHint: true, openWorldHint: true },
  • src/index.ts:46-71 (registration)
    Registration of the 'convert' tool via server.registerTool(), binding the name 'convert', the input schema, and the handler function together.
    server.registerTool(
      "convert",
      {
        title: "Convert currency",
        description:
          "Convert an amount from one currency to another using the latest exchange rate. " +
          "Codes are ISO 4217 (e.g. USD, EUR, GBP). Supports 170+ fiat currencies and major cryptocurrencies.",
        inputSchema: {
          from: z.string().min(3).max(10).describe("Source currency code, e.g. 'USD'"),
          to: z.string().min(3).max(10).describe("Target currency code, e.g. 'EUR'"),
          amount: z.number().positive().describe("Amount in the source currency"),
        },
        annotations: { readOnlyHint: true, openWorldHint: true },
      },
      async ({ from, to, amount }) => {
        try {
          const result = await client.convert(from, to, amount);
          return ok(
            `${amount} ${from.toUpperCase()} = ${result} ${to.toUpperCase()}`,
            { from: from.toUpperCase(), to: to.toUpperCase(), amount, result },
          );
        } catch (err) {
          return fail(err);
        }
      },
    );
  • The client.convert() method that performs the actual API call to /api/convert with the from, to, and amount parameters, returning the parsed numeric result.
    async convert(from: string, to: string, amount: number): Promise<number> {
      const data = await this.request<{ result: string }>("/api/convert", {
        from: from.toUpperCase(),
        to: to.toUpperCase(),
        amount,
      });
      return parseFloat(data.result);
    }
Behavior4/5

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

Annotations already indicate readOnlyHint and openWorldHint. The description adds that it uses the latest exchange rate and supports 170+ fiat and crypto currencies with ISO 4217 codes, which is helpful context beyond the annotations.

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?

Two sentences, front-loaded, no redundant words. Every sentence adds value: first explains action, second defines scope and standard.

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

Completeness4/5

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

Given the tool's simplicity and lack of output schema, the description covers core function, supported currencies, and code standard. Could mention precision or source but not necessary for basic use.

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 coverage is 100% with descriptions for all three parameters. The description does not add new information about individual parameters beyond the schema's examples and hints; baseline is 3.

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?

Description uses specific verb 'convert' and identifies resource as currency amount using latest rate. It clearly distinguishes from sibling tools like historical_rate and list_currencies by focusing on conversion rather than rate lookup or listing.

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

Usage Guidelines3/5

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

The description implies the tool is for converting amounts, but does not explicitly state when to use it versus alternatives like latest_rate (for rate only) or historical_rate. No when-not-to-use guidance is provided.

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/UniRate-API/unirate-mcp'

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