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

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

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "clearCache": { "default": true, "description": "Clear exchange cache to apply changes immediately", "type": "boolean" }, "marketType": { "description": "Market type to set", "enum": [ "spot", "future", "swap", "option", "margin" ], "type": "string" } }, "required": [ "marketType" ], "type": "object" }

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", {

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