Skip to main content
Glama

dex-get-pools

Retrieve all available liquidity pools from the DEX by specifying the network name, enabling users to access essential data for trading and asset management on MantraChain.

Instructions

Get all available liquidity pools from the DEX

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
networkNameYesName of the network to use - must first check available networks through `networks://all`

Implementation Reference

  • MCP tool handler for 'dex-get-pools': initializes MantraClient and retrieves pools via getPools(), returns as JSON text content.
    async ({ networkName }) => { await mantraClient.initialize(networkName); const pools = await mantraClient.getPools(); return { content: [{type: "text", text: JSON.stringify(pools)}], }; }
  • Input schema for the tool using Zod: validates networkName against available networks.
    { networkName: z.string().refine(val => Object.keys(networks).includes(val), { message: "Must be a valid network name" }).describe("Name of the network to use - must first check available networks through `networks://all`"), },
  • src/tools/dex.ts:9-24 (registration)
    Registration of the 'dex-get-pools' MCP tool using server.tool(), including name, description, input schema, and handler.
    server.tool( "dex-get-pools", "Get all available liquidity pools from the DEX", { networkName: z.string().refine(val => Object.keys(networks).includes(val), { message: "Must be a valid network name" }).describe("Name of the network to use - must first check available networks through `networks://all`"), }, async ({ networkName }) => { await mantraClient.initialize(networkName); const pools = await mantraClient.getPools(); return { content: [{type: "text", text: JSON.stringify(pools)}], }; } );
  • Core implementation of getPools() in DexService: queries the DEX smart contract with { pools: {} } to retrieve all pool information.
    async getPools(): Promise<PoolInfo[]> { try { const contractAddress = this.getDexContractAddress(); const response = await this.wasmClient.queryContractSmart(contractAddress, { pools: {} }); return response.pools; } catch (error) { throw new Error(`Failed to get pools: ${error instanceof Error ? error.message : String(error)}`); } }
  • Wrapper method in MantraClient.getPools() that delegates to DexService.getPools() after checking initialization.
    async getPools(): Promise<PoolInfo[]> { if (!this.dexService) { throw new Error('Client not initialized. Call initialize() first.'); } return this.dexService.getPools(); }

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/allthatjazzleo/mantrachain-mcp'

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