Skip to main content
Glama
ethancod1ng

Binance MCP Server

by ethancod1ng

get_24hr_ticker

Retrieve 24-hour price change statistics for cryptocurrency trading pairs on Binance, including price movements and trading volume data.

Instructions

获取24小时价格变动统计

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolNo交易对符号,不传则获取所有交易对

Implementation Reference

  • The handler function for the 'get_24hr_ticker' tool. It validates input using Get24hrTickerSchema, optionally validates symbol, fetches 24hr ticker stats from Binance API using dailyStats, handles single symbol or all, and returns formatted data with timestamp or propagates errors.
    handler: async (binanceClient: any, args: unknown) => {
      const input = validateInput(Get24hrTickerSchema, args);
      
      if (input.symbol) {
        validateSymbol(input.symbol);
      }
    
      try {
        if (input.symbol) {
          const ticker = await binanceClient.dailyStats({ symbol: input.symbol });
          return {
            symbol: input.symbol,
            data: ticker,
            timestamp: Date.now(),
          };
        } else {
          const tickers = await binanceClient.dailyStats();
          return {
            data: Array.isArray(tickers) ? tickers : [tickers],
            timestamp: Date.now(),
          };
        }
      } catch (error) {
        handleBinanceError(error);
      }
  • The inputSchema defined for the MCP tool 'get_24hr_ticker', specifying optional symbol parameter.
    inputSchema: {
      type: 'object',
      properties: {
        symbol: {
          type: 'string',
          description: '交易对符号,不传则获取所有交易对',
        },
      },
      required: [],
    },
  • Zod schema Get24hrTickerSchema used for input validation in the handler.
    export const Get24hrTickerSchema = z.object({
      symbol: z.string().optional().describe('交易对符号,不传则获取所有交易对'),
    });
  • src/server.ts:48-50 (registration)
    Registration loop in MCP server setupTools() that adds 'get_24hr_ticker' (from marketDataTools) to the tools Map by name for handling list_tools and call_tool requests.
    for (const tool of allTools) {
      this.tools.set(tool.name, tool);
    }
  • src/server.ts:42-46 (registration)
    Combines tool arrays including marketDataTools (containing get_24hr_ticker) for registration in MCP server.
    const allTools = [
      ...marketDataTools,
      ...accountTools,
      ...tradingTools,
    ];
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. While '获取' (get) implies a read operation, the description doesn't disclose important behavioral aspects like rate limits, authentication requirements, whether it returns real-time or cached data, or what happens when no symbol is provided (though the schema covers this).

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 Chinese sentence that directly states the tool's purpose with zero wasted words. It's appropriately sized for a simple data retrieval tool.

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?

For a financial data tool with no annotations and no output schema, the description is insufficient. It doesn't explain what statistics are returned (price change percentage, volume, high/low prices, etc.), the data format, or any limitations. The agent would need to guess about the output structure.

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 clear documentation of the symbol parameter. The description adds no additional parameter information beyond what's in the schema. With one parameter and full schema coverage, the baseline of 3 is appropriate.

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 tool's purpose as '获取24小时价格变动统计' (Get 24-hour price change statistics), which is a specific verb+resource combination. However, it doesn't distinguish itself from sibling tools like get_price or get_klines that might provide related price data.

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. With siblings like get_price (current price), get_klines (historical price data), and get_orderbook (market depth), there's no indication of when this specific 24-hour statistics tool is appropriate.

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/ethancod1ng/binance-mcp-server'

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