Skip to main content
Glama

priceConversion

Convert an amount of cryptocurrency or fiat currency to one or more different currencies using current market rates.

Instructions

Convert an amount of one cryptocurrency or fiat currency into one or more different currencies.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
amountYes
idNo
symbolNo
timeNo
convertNo
convert_idNo

Implementation Reference

  • index.js:588-604 (registration)
    Tool registration for 'priceConversion' on the MCP server. Defines the tool name, description, Zod schema for inputs (amount required; id, symbol, time, convert, convert_id optional), and the handler that calls the CoinMarketCap API.
    server.tool("priceConversion",
      "Convert an amount of one cryptocurrency or fiat currency into one or more different currencies.",
      {
        amount: z.number(),
        id: z.string().optional(),
        symbol: z.string().optional(),
        time: z.string().optional(),
        convert: z.string().optional(),
        convert_id: z.string().optional()
      },
      async (params) => {
        return handleEndpoint(async () => {
          const data = await makeApiRequest(apiKey, '/v2/tools/price-conversion', params)
          return formatResponse(data)
        })
      }
    )
  • The handler function for priceConversion. It wraps the API call to '/v2/tools/price-conversion' via makeApiRequest, then formats the response.
    async (params) => {
      return handleEndpoint(async () => {
        const data = await makeApiRequest(apiKey, '/v2/tools/price-conversion', params)
        return formatResponse(data)
      })
    }
  • Input schema for priceConversion using Zod: amount (number, required), id, symbol, time, convert, convert_id (all optional strings).
    {
      amount: z.number(),
      id: z.string().optional(),
      symbol: z.string().optional(),
      time: z.string().optional(),
      convert: z.string().optional(),
      convert_id: z.string().optional()
    },
  • The makeApiRequest helper that constructs and executes the HTTP GET request to the CoinMarketCap API.
    async function makeApiRequest(apiKey, endpoint, params = {}) {
      const queryParams = new URLSearchParams()
      Object.entries(params).forEach(([key, value]) => {
        if (value !== undefined) {
          queryParams.append(key, value.toString())
        }
      })
    
      const url = `https://pro-api.coinmarketcap.com${endpoint}${queryParams.toString() ? `?${queryParams.toString()}` : ''}`
    
      const response = await fetch(url, {
        method: 'GET',
        headers: {
          'Accept': 'application/json',
          'X-CMC_PRO_API_KEY': apiKey,
        }
      })
    
      if (!response.ok) {
        throw new Error(`Error fetching data from CoinMarketCap: ${response.statusText}`)
      }
    
      return await response.json()
    }
  • The handleEndpoint wrapper that catches errors and formats error responses.
    async function handleEndpoint(apiCall) {
      try {
        return await apiCall()
      } catch (error) {
        return formatErrorResponse(error.message, error.status || 403)
      }
    }
Behavior2/5

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

No annotations are provided, so the description must convey behavioral traits. It merely says 'Convert' without indicating whether this is a read-only operation, whether it uses live or historical rates, or any side effects or constraints. This leaves significant ambiguity.

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?

The description is a single sentence of 14 words, front-loaded with the core action. Every word contributes to clarity, and there is no redundancy or verbosity.

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?

Given the lack of output schema and annotations, the description should at least hint at return values (e.g., conversion rates or results). It also omits details like supported currencies or potential errors, making it incomplete for an agent to use accurately.

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

Parameters2/5

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

With 0% schema coverage, the description should explain parameters thoroughly. It implies the meaning of amount and source/destination currencies but does not clarify the roles of id vs symbol, convert vs convert_id, or the time parameter. Additional detail is needed to avoid confusion.

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 explicitly states the action ('Convert') and the resource ('an amount of one cryptocurrency or fiat currency'), and specifies the outcome ('into one or more different currencies'). This clearly distinguishes it from sibling tools like cryptoQuotesLatest or dexInfo.

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?

The description offers no guidance on when to use this tool versus alternatives, such as when conversion is needed versus when quotes or listings would be more appropriate. It only describes functionality without context for selection.

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/shinzo-labs/coinmarketcap-mcp'

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