Skip to main content
Glama

sodax_refresh_cache

Idempotent

Clear cached API data to force fresh fetches for SODAX Builders MCP, ensuring next requests use updated information.

Instructions

Clear the cached API data to force fresh fetches on next requests

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Main MCP tool handler for sodax_refresh_cache. Registers the tool with the server and implements the handler that gets cache stats, clears the cache, and returns a confirmation message.
    // Bonus Tool: Refresh Cache
    server.tool(
      "sodax_refresh_cache",
      "Clear the cached API data to force fresh fetches on next requests",
      {},
      { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
      async () => {
        const statsBefore = getCacheStats();
        clearCache();
        return {
          content: [{
            type: "text",
            text: `Cache cleared. ${statsBefore.size} cached entries removed.`
          }]
        };
      }
    );
  • Service layer functions that implement the actual cache operations: clearCache() clears all cached entries, and getCacheStats() returns the size and keys of the cache.
    /**
     * Clear all cached data
     */
    export function clearCache(): void {
      cache.clear();
    }
    
    /**
     * Get cache statistics
     */
    export function getCacheStats(): { size: number; keys: string[] } {
      return {
        size: cache.size,
        keys: Array.from(cache.keys())
      };
    }
  • Cache data structure and helper functions - defines CacheEntry interface, cache Map instance, getCached(), and setCache() functions used for caching API responses.
    // Cache for API responses
    interface CacheEntry<T> {
      data: T;
      timestamp: number;
    }
    
    const cache = new Map<string, CacheEntry<unknown>>();
    
    function getCached<T>(key: string): T | null {
      const entry = cache.get(key) as CacheEntry<T> | undefined;
      if (!entry) return null;
      if (Date.now() - entry.timestamp > CACHE_DURATION_MS) {
        cache.delete(key);
        return null;
      }
      return entry.data;
    }
    
    function setCache<T>(key: string, data: T): void {
      cache.set(key, { data, timestamp: Date.now() });
    }
  • src/index.ts:19-45 (registration)
    Server setup and tool registration - imports registerSodaxApiTools and calls it to register all SODAX API tools including sodax_refresh_cache on the MCP server.
    import { registerSodaxApiTools } from "./tools/sodaxApi.js";
    import { registerGitBookProxyTools, getGitBookToolNames } from "./tools/gitbookProxy.js";
    import { checkGitBookHealth, fetchGitBookTools } from "./services/gitbookProxy.js";
    import { withAnalytics, shutdownAnalytics } from "./services/analytics.js";
    
    const __filename = fileURLToPath(import.meta.url);
    const __dirname = dirname(__filename);
    
    /**
     * Creates a fully configured McpServer instance.
     * Used per-request in HTTP mode to avoid transport conflicts
     * when handling parallel requests.
     */
    async function createServer(): Promise<McpServer> {
      const server = new McpServer({
        name: "builders-sodax-mcp-server",
        version: "1.0.0"
      });
    
      // Wrap server.tool() so every tool call is tracked in PostHog
      // ⚠️  Must be called BEFORE registering any tools
      withAnalytics(server);
    
      registerSodaxApiTools(server);
      await registerGitBookProxyTools(server);
    
      return server;
  • src/index.ts:192-205 (registration)
    API endpoint documentation - lists sodax_refresh_cache in the available API tools array returned by the /api endpoint.
    tools: {
      api: [
        "sodax_get_supported_chains",
        "sodax_get_swap_tokens",
        "sodax_get_transaction",
        "sodax_get_user_transactions",
        "sodax_get_volume",
        "sodax_get_orderbook",
        "sodax_get_money_market_assets",
        "sodax_get_user_position",
        "sodax_get_partners",
        "sodax_get_token_supply",
        "sodax_refresh_cache"
      ],
Behavior4/5

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

Annotations provide readOnlyHint=false, idempotentHint=true, and destructiveHint=false, indicating it's a non-destructive, idempotent mutation. The description adds value by specifying that it clears cache to force fresh fetches, which is behavioral context not covered by annotations, though it could mention side effects like temporary performance impact.

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 function without any waste. It is front-loaded with the core action and purpose, making it easy to understand quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (simple cache-clearing with no parameters), no output schema, and rich annotations, the description is mostly complete. It explains what the tool does, but could improve by mentioning expected outcomes or confirmation of cache clearance.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0 parameters and 100% schema coverage, the baseline is 4. The description does not need to add parameter details, as there are none, and it appropriately focuses on the tool's action without redundant information.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('Clear') and resource ('cached API data'), and distinguishes it from siblings by specifying its unique function of forcing fresh fetches, unlike other tools that retrieve data.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context ('to force fresh fetches on next requests'), indicating it should be used when cached data is stale or needs updating. However, it does not explicitly state when not to use it or name alternatives, such as whether to use it before or after other tools like sodax_get_* tools.

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

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/gosodax/sodax-builders-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server