Skip to main content
Glama

TOKEN_LIST

Retrieve available tokens for trading on a specified blockchain network through the OpenOcean MCP server.

Instructions

Get token 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 TOKEN_LIST tool. It resolves the chain, calls ChainService.tokenList, handles errors, and returns JSON stringified token list.
    export const tokenList = async (args: z.infer<typeof chainParamsSchema>) => { try { const inputChain = args.chain.toLowerCase(); const chainObject = getChainFromName(inputChain); console.error(`[TOKEN_LIST] Using chain: ${chainObject.name}`); const service = new ChainService(); const tokenList = await service.tokenList(chainObject.id); if (tokenList instanceof Error) { return `Error fetching tokenList: ${tokenList.message}`; } return JSON.stringify(tokenList, null, 2); } catch (error: unknown) { const message = error instanceof Error ? error.message : "An unknown error occurred while fetching tokenList."; console.error(`[TOKEN_LIST] Error: ${message}`); throw new Error(`Failed to fetch tokenList: ${message}`); }
  • Zod schema defining the input parameters for the TOKEN_LIST tool: optional chain name, defaults to '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 exporting the TOKEN_LIST tool with name, description, input schema, and handler reference.
    tokenList: { name: "TOKEN_LIST", description: "Get token list", parameters: chainParamsSchema, execute: chainExecute.tokenList

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