Skip to main content
Glama

clear-cache

Clear cached data on the CCXT MCP Server to ensure up-to-date cryptocurrency exchange integration and optimal performance.

Instructions

Clear CCXT cache

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The MCP tool handler for 'clear-cache'. Calls clearCache() from utils/cache and returns a success message.
    server.tool("clear-cache", "Clear CCXT cache", {}, async () => {
      clearCache();
      return {
        content: [{
          type: "text",
          text: "Cache cleared successfully."
        }]
      };
    });
  • Core implementation of cache clearing logic. When called without arguments (as in the tool handler), clears the entire LRU cache, resets statistics, and logs the action.
    export function clearCache(keyPattern?: string): void {
      if (keyPattern) {
        // Clear all keys matching specific pattern
        const keys = [];
        for (const key of dataCache.keys()) {
          if (typeof key === 'string' && key.includes(keyPattern)) {
            keys.push(key);
          }
        }
        
        // Delete all matching keys from cache
        keys.forEach(key => dataCache.delete(key));
        log(LogLevel.INFO, `Cleared ${keys.length} cache items matching "${keyPattern}"`);
      } else {
        // Clear entire cache
        const size = dataCache.size;
        dataCache.clear();
        log(LogLevel.INFO, `Cleared all ${size} cache items`);
      }
      
      // Update cache statistics
      cacheStats.size = dataCache.size;
      cacheStats.lastCleared = new Date().toISOString();
      cacheStats.hits = 0;
      cacheStats.misses = 0;
    }
  • src/index.ts:163-171 (registration)
    Registers the 'clear-cache' tool on the MCP server with empty schema and description 'Clear CCXT cache'.
    server.tool("clear-cache", "Clear CCXT cache", {}, async () => {
      clearCache();
      return {
        content: [{
          type: "text",
          text: "Cache cleared successfully."
        }]
      };
    });

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