get_supported_tokens
Retrieve supported token lists for blockchain networks to enable cross-chain USDC bridging across Ethereum, Solana, Sui, and Cosmos ecosystems.
Instructions
Get supported tokens for a specific chain or all chains
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chainId | No | Chain ID to get tokens for (optional) | |
| includeTestnets | No | Whether to include testnet tokens |
Implementation Reference
- src/index.ts:385-396 (handler)MCP tool handler for 'get_supported_tokens': parses input using schema and delegates to QuoteService for execution.private async getSupportedTokens(args: any): Promise<MCPToolResult> { try { const request = SupportedTokensRequestSchema.parse(args); const result = await this.quoteService.getSupportedTokens(request); return createSuccessResponse(result); } catch (error) { return createErrorResponse( error instanceof Error ? error.message : String(error), 'INVALID_REQUEST' ); } }
- src/services/quote.ts:65-105 (handler)Core implementation in QuoteService: retrieves supported tokens for specified chain or all chains, filtering testnets if requested.async getSupportedTokens(request: SupportedTokensRequest): Promise<SupportedTokensResponse> { const { chainId, includeTestnets = false } = request; if (chainId) { const chainIdTyped = chainId as SupportedChainId; const chainInfo = CHAIN_INFO[chainIdTyped]; if (!chainInfo) { throw new Error(`Unsupported chain: ${chainId}`); } if (!includeTestnets && chainInfo.isTestnet) { return { tokens: [], chains: [] }; } const tokens = await this.getTokensForChain(chainIdTyped); return { tokens, chains: [chainInfo], }; } // Get tokens for all chains const allTokens: Token[] = []; const allChains: typeof CHAIN_INFO[keyof typeof CHAIN_INFO][] = []; for (const [chainId, chainInfo] of Object.entries(CHAIN_INFO)) { if (!includeTestnets && chainInfo.isTestnet) { continue; } const tokens = await this.getTokensForChain(chainId as SupportedChainId); allTokens.push(...tokens); allChains.push(chainInfo); } return { tokens: allTokens, chains: allChains, }; }
- src/types/index.ts:166-171 (schema)Zod schema defining input parameters for get_supported_tokens tool: optional chainId and includeTestnets flag.export const SupportedTokensRequestSchema = z.object({ chainId: z.union([z.number(), z.string()]).optional(), includeTestnets: z.boolean().optional().default(false), }); export type SupportedTokensRequest = z.infer<typeof SupportedTokensRequestSchema>;
- src/index.ts:79-99 (registration)Tool registration in ListTools handler: defines name, description, and inputSchema matching the Zod schema.name: 'get_supported_tokens', description: 'Get supported tokens for a specific chain or all chains', inputSchema: { type: 'object', properties: { chainId: { oneOf: [ { type: 'number' }, { type: 'string' }, ], description: 'Chain ID to get tokens for (optional)', }, includeTestnets: { type: 'boolean', description: 'Whether to include testnet tokens', default: false, }, }, additionalProperties: false, }, },
- src/services/quote.ts:237-262 (helper)Helper method that populates tokens for a chain using constants (native token and USDC).private async getTokensForChain(chainId: SupportedChainId): Promise<Token[]> { const chainInfo = CHAIN_INFO[chainId]; const tokens: Token[] = []; // Add native token if (NATIVE_TOKENS[chainId]) { tokens.push(NATIVE_TOKENS[chainId]); } // Add USDC if available if (chainInfo.usdcAddress) { tokens.push({ address: chainInfo.usdcAddress, chainId, symbol: 'USDC', name: 'USD Coin', decimals: 6, isNative: false, logoURI: 'https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png', }); } // For production, you'd fetch from token lists or APIs // For now, we'll return the basic tokens return tokens; }