Skip to main content
Glama

set-market-type

Define the default market type (spot, future, swap, option, or margin) for all exchanges within the CCXT MCP Server. Optionally clear the cache to apply changes instantly.

Instructions

Set default market type for all exchanges

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
clearCacheNoClear exchange cache to apply changes immediately
marketTypeYesMarket type to set

Implementation Reference

  • The handler function for the 'set-market-type' tool. Sets DEFAULT_MARKET_TYPE environment variable and optionally clears the exchange cache.
    }, async ({ marketType, clearCache }) => {
      try {
        // Set market type in environment variables
        process.env.DEFAULT_MARKET_TYPE = marketType;
        log(LogLevel.INFO, `Default market type set to: ${marketType}`);
        
        // Clear cache if requested
        if (clearCache) {
          clearExchangeCache();
          log(LogLevel.INFO, "Exchange cache cleared to apply new market type");
        }
        
        return {
          content: [{
            type: "text",
            text: JSON.stringify({
              success: true,
              message: `Default market type set to: ${marketType}`,
              cacheCleared: clearCache,
              note: clearCache 
                ? "Exchange cache was cleared. New market type will be applied immediately."
                : "Changes will only affect newly created exchange instances. Use clear-exchange-cache tool for immediate effect."
            }, null, 2)
          }]
        };
      } catch (error) {
        log(LogLevel.ERROR, `Error setting market type: ${error instanceof Error ? error.message : String(error)}`);
        return {
          content: [{
            type: "text",
            text: `Error: ${error instanceof Error ? error.message : String(error)}`
          }],
          isError: true
        };
      }
    });
  • Zod schema defining the input parameters for the 'set-market-type' tool: marketType (enum) and clearCache (boolean).
    marketType: z.enum(["spot", "future", "swap", "option", "margin"]).describe("Market type to set"),
    clearCache: z.boolean().default(true).describe("Clear exchange cache to apply changes immediately")
  • Registration of the 'set-market-type' tool on the MCP server instance.
    server.tool("set-market-type", "Set default market type for all exchanges", {
Behavior2/5

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

With no annotations provided, the description carries full burden but only states the basic action. It doesn't disclose critical behavioral traits like whether this is a global configuration change, permission requirements, rate limits, or what happens to existing market data. The 'clearCache' parameter hints at some behavior but isn't explained in the description.

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 with zero wasted words. It's appropriately sized and front-loaded, making it easy for an agent 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 this is a configuration mutation tool with no annotations and no output schema, the description is incomplete. It should explain the scope of changes (e.g., affects all exchanges globally), potential side effects, or what confirmation/error responses look like, but provides none of this context.

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%, so the schema fully documents both parameters. The description adds no additional parameter semantics beyond what's in the schema, maintaining the baseline score of 3 for adequate but not enhanced 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 action ('Set') and the target ('default market type for all exchanges'), which is specific and unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'get-market-types' or 'set-leverage', which would be needed for 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. It doesn't mention prerequisites, side effects, or compare it to related tools like 'set-leverage' or 'set-margin-mode', leaving the agent to infer usage context.

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