Skip to main content
Glama
RWAValueRouter

ValueRouter MCP Server

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
NameRequiredDescriptionDefault
chainIdNoChain ID to get tokens for (optional)
includeTestnetsNoWhether to include testnet tokens

Implementation Reference

  • 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'
        );
      }
    }
  • 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,
      };
    }
  • 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,
      },
    },
  • 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;
    }

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/RWAValueRouter/MCP'

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