Skip to main content
Glama

DEX_LIST

Retrieve a list of decentralized exchanges (DEXs) available on a specified blockchain network to identify trading platforms for token swaps.

Instructions

Get dex list

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chainNoThe blockchain network to execute the transaction on. uses fraxtal as defaultfraxtal

Implementation Reference

  • The main handler function that executes the DEX_LIST tool logic. It resolves the chain from input, fetches the DEX list using ChainService, handles errors, and returns a JSON string.
    export const dexList = async (args: z.infer<typeof chainParamsSchema>) => { try { const inputChain = args.chain.toLowerCase(); const chainObject = getChainFromName(inputChain); console.error(`[DEX_LIST] Using chain: ${chainObject.name}`); const service = new ChainService(); const dexList = await service.dexList(chainObject.id); if (dexList instanceof Error) { return `Error fetching dexList: ${dexList.message}`; } return JSON.stringify(dexList, null, 2); } catch (error: unknown) { const message = error instanceof Error ? error.message : "An unknown error occurred while fetching dexList."; console.error(`[DEX_LIST] Error: ${message}`); throw new Error(`Failed to fetch dexList: ${message}`); } }
  • Zod schema for input parameters of DEX_LIST (and other chain tools), defining an optional chain name with default 'fraxtal'.
    export const chainParamsSchema = z.object({ chain: z .string() .optional() .describe( "The blockchain network to execute the transaction on. uses fraxtal as default", ) .default("fraxtal") });
  • Tool registration object for DEX_LIST, specifying name, description, input schema, and the execute handler reference.
    dexList: { name: "DEX_LIST", description: "Get dex list", parameters: chainParamsSchema, execute: chainExecute.dexList },

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/openocean-finance/openocean-mcp'

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