Skip to main content
Glama

TOKEN_LIST

Retrieve available tokens for trading on OpenOcean MCP's decentralized exchange across multiple blockchain networks.

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 for the TOKEN_LIST tool. It takes chain parameters, resolves the chain object, fetches the token list from ChainService, handles errors, and returns JSON stringified result.
    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 defaulting 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 definition object for TOKEN_LIST, including name, description, parameters schema, and reference to the execute handler.
    tokenList: { name: "TOKEN_LIST", description: "Get token list", parameters: chainParamsSchema, execute: chainExecute.tokenList },
  • src/index.ts:14-14 (registration)
    Registers the TOKEN_LIST tool with the FastMCP server instance.
    server.addTool(tools.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