Skip to main content
Glama

get_crypto_price

Retrieve real-time cryptocurrency prices from CoinCap's API to monitor market values and track specific coin performance.

Instructions

Get realtime crypto price on crypto

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameNoName of the crypto coin

Implementation Reference

  • The `toolCall` method that executes the core logic: extracts crypto name from arguments, fetches price data from Coincap API endpoint, returns JSON data or error response.
    async toolCall(request: z.infer<typeof CallToolRequestSchema>) {
      try {
        const cryptoName = request.params.arguments?.name;
        if (!cryptoName) {
          throw new Error("Missing crypto name");
        }
        const url = CONSTANTS.CRYPTO_PRICE_URL + cryptoName;
    
        const response = await fetch(url);
        if (!response.ok) {
          throw new Error("Error fetching coincap data");
        }
    
        const body = await response.json();
    
        return {
          content: [{ type: "text", text: JSON.stringify(body.data) }],
        };
      } catch (error) {
        return {
          content: [
            { type: "error", text: JSON.stringify((error as any).message) },
          ],
        };
      }
    }
  • Tool definition including name, description, and input schema specifying a required 'name' string for the cryptocurrency.
    toolDefinition: Tool = {
      name: this.name,
      description: "Get realtime crypto price on crypto",
      inputSchema: {
        type: "object",
        properties: {
          name: {
            type: "string",
            description: "Name of the crypto coin",
          },
        },
      },
    };
  • Creates a Map of tools keyed by their name (including 'get_crypto_price') for lookup during tool calls.
    export function createToolsMap(tools: BaseTool[]): Map<string, BaseTool> {
      return new Map(tools.map((tool) => [tool.name, tool]));
    }
  • Defines CRYPTO_PRICE_URL constant used by the get_crypto_price handler to construct the API endpoint.
    export const CONSTANTS = {
      CRYPTO_PRICE_URL: "https://api.coincap.io/v2/assets/",
      PROJECT_NAME: "coincap-mcp",
      PROJECT_VERSION: "0.9.2",
    };
  • Exports the GetCryptoPrice class for dynamic loading and instantiation by the tool loader.
    export default GetCryptoPrice;
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions 'realtime' which hints at freshness, but doesn't disclose behavioral traits like rate limits, data sources, error handling, or what 'realtime' means operationally. It's minimal for a tool with no annotation coverage.

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

Conciseness4/5

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

The description is a single, short sentence that's front-loaded with the core purpose. However, it's slightly redundant ('on crypto') and could be more polished, but it earns its place efficiently.

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 no annotations and no output schema, the description is incomplete. It doesn't explain return values, error cases, or operational constraints. For a tool fetching real-time data, more context on behavior and output is needed.

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%, with the parameter 'name' documented as 'Name of the crypto coin'. The description adds no additional meaning beyond this, such as format examples or valid coin names. Baseline 3 is appropriate since the schema does the heavy lifting.

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

Purpose3/5

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

The description states the tool 'Get realtime crypto price on crypto' which identifies the verb ('get') and resource ('crypto price'), but it's vague about scope and duplicates 'crypto' awkwardly. It doesn't clearly differentiate from sibling tools like 'bitcoin_price' or 'list_assets'.

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 is provided on when to use this tool versus alternatives like 'bitcoin_price' (specific to Bitcoin) or 'list_assets' (which might list multiple assets). The description implies real-time pricing but doesn't specify contexts or exclusions.

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

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