Skip to main content
Glama

get-crypto-price

Retrieve real-time cryptocurrency prices and 24-hour market statistics by inputting a specific cryptocurrency symbol. Powered by CoinCap API v3 for accurate data.

Instructions

Get current price and 24h stats for a cryptocurrency

Input Schema

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

Implementation Reference

  • Main execution handler for the 'get-crypto-price' tool. Parses input using Zod schema, fetches cryptocurrency assets from CoinCap service, finds the matching asset, and returns formatted price information.
    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) }], }; }
  • Zod schema used in the handler for validating the tool's input argument 'symbol'.
    export const GetPriceArgumentsSchema = z.object({ symbol: z.string().min(1), });
  • src/index.ts:31-44 (registration)
    Registration of the 'get-crypto-price' tool in the ListToolsRequestSchema handler, including name, description, and MCP-compatible input schema.
    { 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:93-94 (registration)
    Dispatch logic in the CallToolRequestSchema handler that routes 'get-crypto-price' calls to the handleGetPrice function.
    case "get-crypto-price": return await handleGetPrice(args);

Other Tools

Related 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