Skip to main content
Glama

sodax_get_supported_chains

Retrieve a list of blockchain networks supported for cross-chain swaps and DeFi operations through the SODAX platform.

Instructions

List all blockchain networks supported by SODAX for cross-chain swaps and DeFi operations

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
formatNoResponse format: 'json' for raw data or 'markdown' for formatted textmarkdown

Implementation Reference

  • The MCP tool handler for sodax_get_supported_chains. This async function calls getSupportedChains() service and formats the response as JSON or Markdown based on the format parameter.
    server.tool(
      "sodax_get_supported_chains",
      "List all blockchain networks supported by SODAX for cross-chain swaps and DeFi operations",
      {
        format: z.nativeEnum(ResponseFormat).optional().default(ResponseFormat.MARKDOWN)
          .describe("Response format: 'json' for raw data or 'markdown' for formatted text")
      },
      READ_ONLY,
      async ({ format }) => {
        try {
          const chains = await getSupportedChains();
          return {
            content: [{
              type: "text",
              text: formatResponse(chains, format)
            }]
          };
        } catch (error) {
          return {
            content: [{ type: "text", text: `Error: ${error instanceof Error ? error.message : "Unknown error"}` }],
            isError: true
          };
        }
      }
    );
  • The core service function that fetches supported chains from the SODAX API endpoint /config/spoke/chains, with caching support.
    export async function getSupportedChains(): Promise<Chain[]> {
      const cacheKey = "chains";
      const cached = getCached<Chain[]>(cacheKey);
      if (cached) return cached;
    
      try {
        const response = await apiClient.get("/config/spoke/chains");
        // API returns array directly
        const chains = Array.isArray(response.data) ? response.data : (response.data?.data || []);
        setCache(cacheKey, chains);
        return chains;
      } catch (error) {
        console.error("Error fetching chains:", error);
        throw new Error("Failed to fetch supported chains from SODAX API");
      }
    }
  • Zod schema definition for the tool's input parameters - optional format field that accepts 'json' or 'markdown' (defaults to markdown).
    server.tool(
      "sodax_get_supported_chains",
      "List all blockchain networks supported by SODAX for cross-chain swaps and DeFi operations",
      {
        format: z.nativeEnum(ResponseFormat).optional().default(ResponseFormat.MARKDOWN)
          .describe("Response format: 'json' for raw data or 'markdown' for formatted text")
      },
  • TypeScript interface Chain that defines the structure of blockchain network data returned by the API (id, name, chainId, nativeCurrency, etc.).
    export interface Chain {
      id: string;
      name: string;
      chainId: number;
      nativeCurrency: {
        name: string;
        symbol: string;
        decimals: number;
      };
      rpcUrl?: string;
      explorerUrl?: string;
      iconUrl?: string;
      isTestnet?: boolean;
    }
  • src/index.ts:42-42 (registration)
    Registration call where registerSodaxApiTools(server) is invoked to register all SODAX API tools including sodax_get_supported_chains with the MCP server.
    registerSodaxApiTools(server);

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