Skip to main content
Glama

get-market-types

Identify supported market types for a specific cryptocurrency exchange using the CCXT MCP Server. Input the exchange ID to receive detailed market type information for seamless integration.

Instructions

Get market types supported by an exchange

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
exchangeYesExchange ID (e.g., binance, coinbase)

Implementation Reference

  • The handler function for the 'get-market-types' tool. It rate-limits the request, retrieves the exchange instance, determines supported market types by checking for leverage tiers, existing markets, and attempting to load future and swap markets, then returns a JSON string of the unique market types.
    }, async ({ exchange }) => {
      try {
        return await rateLimiter.execute(exchange, async () => {
          const ex = getExchange(exchange);
          // Get markets and group by contract type
          let marketTypes = ['spot']; // Spot is always available
          
          // Try to access exchange's market type property if available
          if (ex.has && ex.has.fetchMarketLeverageTiers) {
            marketTypes.push('future');
          }
          
          // Some exchanges have specific markets property
          if (ex.markets) {
            const markets = Object.values(ex.markets);
            for (const market of markets) {
              const type = (market as any).type;
              if (type && !marketTypes.includes(type)) {
                marketTypes.push(type);
              }
            }
          }
          
          // Manually check for common market types
          try {
            const futureEx = getExchangeWithMarketType(exchange, 'future');
            await futureEx.loadMarkets();
            if (Object.keys(futureEx.markets).length > 0) {
              if (!marketTypes.includes('future')) marketTypes.push('future');
            }
          } catch (e) {
            // Future markets not available
          }
          
          try {
            const swapEx = getExchangeWithMarketType(exchange, 'swap');
            await swapEx.loadMarkets();
            if (Object.keys(swapEx.markets).length > 0) {
              if (!marketTypes.includes('swap')) marketTypes.push('swap');
            }
          } catch (e) {
            // Swap markets not available
          }
          
          return {
            content: [{
              type: "text",
              text: JSON.stringify({
                exchange,
                marketTypes: [...new Set(marketTypes)], // Remove duplicates
              }, null, 2)
            }]
          };
        });
      } catch (error) {
        log(LogLevel.ERROR, `Error fetching market types: ${error instanceof Error ? error.message : String(error)}`);
        return {
          content: [{
            type: "text",
            text: `Error: ${error instanceof Error ? error.message : String(error)}`
          }],
          isError: true
        };
      }
    });
  • Zod schema definition for the input parameter 'exchange' of the get-market-types tool.
    exchange: z.string().describe("Exchange ID (e.g., binance, coinbase)"),
  • Registration of the 'get-market-types' tool with server.tool, including description and linking to schema and inline handler.
    server.tool("get-market-types", "Get market types supported by 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 describes a read operation ('Get'), which implies non-destructive behavior, but lacks details on permissions, rate limits, error handling, or return format. This is a significant gap 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 any unnecessary words or fluff. It is appropriately sized and front-loaded, making it easy to understand at a glance.

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 but incomplete. It covers the basic purpose but lacks usage guidelines, behavioral details, and output information, leaving gaps that could hinder effective tool selection and invocation.

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 'exchange' parameter clearly documented. The description adds no additional meaning beyond the schema, such as examples of market types or context on what 'supported' entails. Baseline score of 3 is appropriate as the schema handles 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 verb 'Get' and the resource 'market types supported by an exchange', making the purpose specific and understandable. However, it doesn't explicitly differentiate from sibling tools like 'get-markets' or 'get-exchange-info', which might overlap in functionality, preventing 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 such as 'get-markets' or 'get-exchange-info', nor does it mention any prerequisites or exclusions. It only states what the tool does, leaving usage context implied and incomplete.

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