Skip to main content
Glama
gagarinyury

MCP Bitget Trading Server

by gagarinyury

getTicker

Retrieve real-time trading pair data including price, volume, and market information for cryptocurrency trading decisions on Bitget exchange.

Instructions

Get full ticker information for a trading pair

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYesTrading pair symbol

Implementation Reference

  • MCP server handler for 'getTicker' tool: parses arguments with GetTickerSchema, calls BitgetRestClient.getTicker(), and returns JSON stringified result.
    case 'getTicker': {
      const { symbol } = GetTickerSchema.parse(args);
      const ticker = await this.bitgetClient.getTicker(symbol);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(ticker, null, 2),
          },
        ],
      } as CallToolResult;
    }
  • Zod schema definition for getTicker tool input validation (symbol parameter).
    export const GetTickerSchema = z.object({
      symbol: z.string().describe('Trading pair symbol (BTCUSDT for spot, BTCUSDT_UMCBL for futures)')
    });
  • src/server.ts:114-124 (registration)
    Tool registration in MCP server's listTools response, defining name, description, and input schema.
    {
      name: 'getTicker',
      description: 'Get full ticker information for a trading pair',
      inputSchema: {
        type: 'object',
        properties: {
          symbol: { type: 'string', description: 'Trading pair symbol' }
        },
        required: ['symbol']
      },
    },
  • Core implementation of getTicker in BitgetRestClient: handles spot/futures detection, API calls to Bitget endpoints, caching with tickerCache, and formats Ticker response.
    async getTicker(symbol: string): Promise<Ticker> {
      const cacheKey = `ticker:${symbol}`;
      
      // Try cache first
      const cachedTicker = tickerCache.get(cacheKey);
      if (cachedTicker) {
        return cachedTicker;
      }
    
      let ticker: Ticker = {
        symbol: '',
        last: '',
        bid: '',
        ask: '',
        high24h: '',
        low24h: '',
        volume24h: '',
        change24h: '',
        changePercent24h: '',
        timestamp: 0
      };
      
      if (this.isFuturesSymbol(symbol)) {
        // Futures ticker
        const futuresSymbol = symbol.includes('_UMCBL') ? symbol : `${symbol}_UMCBL`;
        const response = await this.request<any>('GET', '/api/mix/v1/market/ticker', { symbol: futuresSymbol });
        if (response.data) {
          const tickerData = response.data;
          ticker = {
            symbol: tickerData.symbol,
            last: tickerData.last,
            bid: tickerData.bestBid,
            ask: tickerData.bestAsk,
            high24h: tickerData.high24h,
            low24h: tickerData.low24h,
            volume24h: tickerData.baseVolume,
            change24h: ((parseFloat(tickerData.last) - parseFloat(tickerData.openUtc)) / parseFloat(tickerData.openUtc) * 100).toFixed(2),
            changePercent24h: tickerData.priceChangePercent,
            timestamp: parseInt(tickerData.timestamp) || Date.now()
          };
        } else {
          throw new Error(`Ticker not found for symbol: ${symbol}`);
        }
      } else {
        // Spot ticker - use v1 public API
        const response = await this.request<any>('GET', '/api/spot/v1/market/tickers', {});
        if (response.data && Array.isArray(response.data)) {
          const tickerData = response.data.find((t: any) => t.symbol === symbol);
          if (tickerData) {
            ticker = {
              symbol: tickerData.symbol,
              last: tickerData.close,
              bid: tickerData.buyOne,
              ask: tickerData.sellOne,
              high24h: tickerData.high24h,
              low24h: tickerData.low24h,
              volume24h: tickerData.baseVol,
              change24h: tickerData.change,
              changePercent24h: tickerData.changePercent,
              timestamp: parseInt(tickerData.ts) || Date.now()
            };
          } else {
            throw new Error(`Ticker not found for symbol: ${symbol}`);
          }
        } else {
          throw new Error(`Ticker not found for symbol: ${symbol}`);
        }
      }
      
      // Cache the result
      tickerCache.set(cacheKey, ticker);
      return ticker;
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool 'Get[s] full ticker information' but does not clarify what 'full' entails (e.g., includes volume, bid/ask prices), whether it's a read-only operation, or any rate limits or authentication needs. This leaves significant behavioral gaps for an agent.

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, clear sentence with no wasted words, making it highly concise and front-loaded. It efficiently communicates the core purpose without unnecessary elaboration.

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 the tool's low complexity (1 parameter, no output schema, no annotations), the description is minimally adequate. It states what the tool does but lacks details on output format, error handling, or behavioral traits. Without annotations or output schema, more context would improve completeness, but it's not entirely inadequate.

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 input schema has 100% description coverage, with the parameter 'symbol' documented as 'Trading pair symbol'. The description adds no additional semantic context beyond this, such as format examples (e.g., 'BTC/USD') or validation rules. Thus, it meets the baseline of 3 where the schema does the heavy lifting.

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 action ('Get') and resource ('full ticker information for a trading pair'), making the purpose understandable. However, it does not explicitly differentiate from sibling tools like 'getPrice' or 'subscribeToTicker', which limits its score to 4 instead of 5.

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 'getPrice' (which might return simpler price data) or 'subscribeToTicker' (for real-time updates). It lacks explicit when/when-not instructions or named alternatives, resulting in minimal usage guidance.

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/gagarinyury/MCP-bitget-trading'

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