Skip to main content
Glama

get-markets

Retrieve all available markets for a specified cryptocurrency exchange using the CCXT MCP Server. Input the exchange ID to fetch market data with optional pagination for efficient results.

Instructions

Get all available markets for an exchange

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
exchangeYesExchange ID (e.g., binance, coinbase)
pageNoPage number
pageSizeNoItems per page

Implementation Reference

  • Full tool registration including schema, handler logic for fetching, caching, and paginating exchange markets using ccxt-like exchange instance.
    server.tool("get-markets", "Get all available markets for an exchange", {
      exchange: z.string().describe("Exchange ID (e.g., binance, coinbase)"),
      page: z.number().optional().default(1).describe("Page number"),
      pageSize: z.number().optional().default(100).describe("Items per page")
    }, async ({ exchange, page, pageSize }) => {
      try {
        return await rateLimiter.execute(exchange, async () => {
          const ex = getExchange(exchange);
          const cacheKey = `markets:${exchange}`;
          
          const allMarkets = await getCachedData(cacheKey, async () => {
            log(LogLevel.INFO, `Fetching all markets for ${exchange}`);
            await ex.loadMarkets();
            return Object.values(ex.markets);
          }, 3600000); // Cache for 1 hour
          
          // Simple pagination
          const start = (page - 1) * pageSize;
          const end = start + pageSize;
          const pagedMarkets = allMarkets.slice(start, end);
          
          return {
            content: [{
              type: "text",
              text: JSON.stringify({
                total: allMarkets.length,
                page,
                pageSize,
                data: pagedMarkets
              }, null, 2)
            }]
          };
        });
      } catch (error) {
        log(LogLevel.ERROR, `Error fetching markets: ${error instanceof Error ? error.message : String(error)}`);
        return {
          content: [{
            type: "text",
            text: `Error: ${error instanceof Error ? error.message : String(error)}`
          }],
          isError: true
        };
      }
    });
  • Zod schema for get-markets tool parameters: exchange (required string), page and pageSize (optional numbers with defaults).
      exchange: z.string().describe("Exchange ID (e.g., binance, coinbase)"),
      page: z.number().optional().default(1).describe("Page number"),
      pageSize: z.number().optional().default(100).describe("Items per page")
    }, async ({ exchange, page, pageSize }) => {
  • Registration of the 'get-markets' tool with server.tool, including name and description.
    server.tool("get-markets", "Get all available markets for an exchange", {
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 action ('Get') but doesn't describe whether this is a read-only operation, if it requires authentication, rate limits, or what the return format looks like. This leaves significant gaps for an agent to understand how to handle the tool effectively.

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 any unnecessary words. It's front-loaded and appropriately sized for its function, 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 complexity of a tool with 3 parameters, no annotations, and no output schema, the description is insufficient. It doesn't explain return values, error handling, or behavioral traits like pagination details, leaving the agent with incomplete information to use the tool correctly.

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, so the schema already documents all parameters (exchange, page, pageSize) adequately. The description doesn't add any extra meaning beyond implying that 'exchange' is required, which is already in the schema, resulting in a baseline score of 3.

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 ('all available markets for an exchange'), making the purpose understandable. However, it doesn't explicitly differentiate from sibling tools like 'get-exchange-info' or 'get-market-types', which might have overlapping functionality, so it doesn't reach the highest 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 'list-exchanges' or 'get-exchange-info'. It lacks context about prerequisites, such as needing an exchange ID, and doesn't mention any exclusions or specific use cases.

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