Skip to main content
Glama

get-ticker

Retrieve real-time ticker data, including price, volume, and market details, for specified trading pairs across multiple cryptocurrency exchanges using CCXT MCP Server.

Instructions

Get current ticker information for a trading pair

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
exchangeYesExchange ID (e.g., binance, coinbase)
marketTypeNoMarket type (default: spot)
symbolYesTrading pair symbol (e.g., BTC/USDT)

Implementation Reference

  • The main handler function for the 'get-ticker' tool. It rate-limits the API call, selects the exchange instance based on market type, uses caching to fetch ticker data via ex.fetchTicker(symbol), and returns formatted JSON response or error.
    }, async ({ exchange, symbol, marketType }) => {
      try {
        return await rateLimiter.execute(exchange, async () => {
          const ex = marketType 
            ? getExchangeWithMarketType(exchange, marketType)
            : getExchange(exchange);
          const cacheKey = `ticker:${exchange}:${marketType || 'spot'}:${symbol}`;
          
          const ticker = await getCachedData(cacheKey, async () => {
            log(LogLevel.INFO, `Fetching ticker for ${symbol} on ${exchange}`);
            return await ex.fetchTicker(symbol);
          });
          
          return {
            content: [{
              type: "text",
              text: JSON.stringify(ticker, null, 2)
            }]
          };
        });
      } catch (error) {
        log(LogLevel.ERROR, `Error fetching ticker: ${error instanceof Error ? error.message : String(error)}`);
        return {
          content: [{
            type: "text",
            text: `Error: ${error instanceof Error ? error.message : String(error)}`
          }],
          isError: true
        };
      }
    });
  • Input schema using Zod for validating parameters: exchange (string), symbol (string), marketType (optional enum).
    exchange: z.string().describe("Exchange ID (e.g., binance, coinbase)"),
    symbol: z.string().describe("Trading pair symbol (e.g., BTC/USDT)"),
    marketType: z.enum(["spot", "future", "swap", "option", "margin"]).optional().describe("Market type (default: spot)")
  • The server.tool() registration call for 'get-ticker', including description, schema, and inline handler function within registerPublicTools.
    server.tool("get-ticker", "Get current ticker information for a trading pair", {
      exchange: z.string().describe("Exchange ID (e.g., binance, coinbase)"),
      symbol: z.string().describe("Trading pair symbol (e.g., BTC/USDT)"),
      marketType: z.enum(["spot", "future", "swap", "option", "margin"]).optional().describe("Market type (default: spot)")
    }, async ({ exchange, symbol, marketType }) => {
      try {
        return await rateLimiter.execute(exchange, async () => {
          const ex = marketType 
            ? getExchangeWithMarketType(exchange, marketType)
            : getExchange(exchange);
          const cacheKey = `ticker:${exchange}:${marketType || 'spot'}:${symbol}`;
          
          const ticker = await getCachedData(cacheKey, async () => {
            log(LogLevel.INFO, `Fetching ticker for ${symbol} on ${exchange}`);
            return await ex.fetchTicker(symbol);
          });
          
          return {
            content: [{
              type: "text",
              text: JSON.stringify(ticker, null, 2)
            }]
          };
        });
      } catch (error) {
        log(LogLevel.ERROR, `Error fetching ticker: ${error instanceof Error ? error.message : String(error)}`);
        return {
          content: [{
            type: "text",
            text: `Error: ${error instanceof Error ? error.message : String(error)}`
          }],
          isError: true
        };
      }
    });
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states it 'gets' information, implying a read-only operation, but doesn't mention potential side effects like caching, rate limits, authentication needs, or response format. This is inadequate 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.

Conciseness5/5

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

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It is appropriately sized and front-loaded, making it easy to parse quickly.

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 annotations and output schema, the description is incomplete. It doesn't explain what 'ticker information' includes (e.g., price, volume), potential errors, or behavioral traits like real-time vs. cached data. For a financial data tool with no structured output, more context 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?

The schema description coverage is 100%, with clear descriptions for all parameters (exchange, marketType, symbol). The description adds no additional parameter semantics beyond what the schema provides, so it meets the baseline score for high schema coverage.

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

Purpose4/5

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

The description clearly states the verb ('Get') and resource ('current ticker information for a trading pair'), making the purpose specific and understandable. However, it doesn't explicitly differentiate from sibling tools like 'batch-get-tickers' or 'get-exchange-info', which prevents a perfect score.

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 provides no guidance on when to use this tool versus alternatives like 'batch-get-tickers' for multiple pairs or 'get-exchange-info' for exchange metadata. It lacks context on prerequisites or exclusions, leaving usage decisions ambiguous.

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

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/doggybee/mcp-server-ccxt'

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