Skip to main content
Glama

get-crypto-price

Retrieve current price and 24-hour market statistics for a cryptocurrency by providing its symbol (e.g., BTC, ETH).

Instructions

Get current price and 24h stats for a cryptocurrency

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYesCryptocurrency symbol (e.g., BTC, ETH)

Implementation Reference

  • Zod schema for get-crypto-price input validation: requires a 'symbol' string field
    export const GetPriceArgumentsSchema = z.object({
      symbol: z.string().min(1),
    });
  • handleGetPrice function: parses args, fetches assets from CoinCap API via getAssets(), finds the asset by symbol, and returns formatted price info
    export async function handleGetPrice(args: unknown) {
      const { symbol } = GetPriceArgumentsSchema.parse(args);
      const upperSymbol = symbol.toUpperCase();
    
      const assetsData = await getAssets();
      if (!assetsData) {
        return {
          content: [{ type: "text", text: "Failed to retrieve cryptocurrency data" }],
        };
      }
    
      const asset = assetsData.data.find(
        (a: { symbol: string; }) => a.symbol.toUpperCase() === upperSymbol
      );
    
      if (!asset) {
        return {
          content: [
            {
              type: "text",
              text: `Could not find cryptocurrency with symbol ${upperSymbol}`,
            },
          ],
        };
      }
    
      return {
        content: [{ type: "text", text: formatPriceInfo(asset) }],
      };
    }
  • src/index.ts:30-44 (registration)
    Tool registration for 'get-crypto-price': defines name, description, and inputSchema requiring a 'symbol' string parameter
    tools: [
      {
        name: "get-crypto-price",
        description: "Get current price and 24h stats for a cryptocurrency",
        inputSchema: {
          type: "object",
          properties: {
            symbol: {
              type: "string",
              description: "Cryptocurrency symbol (e.g., BTC, ETH)",
            },
          },
          required: ["symbol"],
        },
      },
  • src/index.ts:92-94 (registration)
    Call handler routing: dispatches 'get-crypto-price' tool calls to handleGetPrice
    switch (name) {
      case "get-crypto-price":
        return await handleGetPrice(args);
  • formatPriceInfo helper: formats asset data (price, 24h change, volume, market cap, rank) into a human-readable string
    export function formatPriceInfo(asset: CryptoAsset): string {
      const price = parseFloat(asset.priceUsd).toFixed(2);
      const change = parseFloat(asset.changePercent24Hr).toFixed(2);
      const volume = (parseFloat(asset.volumeUsd24Hr) / 1000000).toFixed(2);
      const marketCap = (parseFloat(asset.marketCapUsd) / 1000000000).toFixed(2);
      
      return [
        `${asset.name} (${asset.symbol})`,
        `Price: $${price}`,
        `24h Change: ${change}%`,
        `24h Volume: $${volume}M`,
        `Market Cap: $${marketCap}B`,
        `Rank: #${asset.rank}`,
      ].join('\n');
    }
Behavior2/5

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

No annotations provided, so description must carry full burden. Only states output is price and 24h stats, but omits details like update frequency, data source, or behavior on invalid symbol.

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?

Single sentence, no unnecessary words, front-loaded with verb and resource.

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

Completeness3/5

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

Given simple tool (1 param, no output schema, no annotations), description is adequate for basic understanding but lacks detail on what '24h stats' includes (e.g., change, volume).

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%, baseline 3. Description adds no extra detail beyond 'gets crypto price for given symbol'; schema already specifies symbol as string with examples.

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 clearly states verb 'get', resource 'current price and 24h stats', and scope 'cryptocurrency'. Easily distinguished from siblings 'historical-analysis' and 'market-analysis'.

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 (e.g., for historical data use get-historical-analysis). No exclusions or prerequisites mentioned.

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/wazzan/mcp-coincap-jj'

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