Skip to main content
Glama

ValueRouter MCP Server

get_supported_tokens

Retrieves a list of supported tokens for a specific blockchain or across all chains, optionally including testnet tokens, leveraging the ValueRouter MCP Server for multi-chain USDC bridging.

Instructions

Get supported tokens for a specific chain or all chains

Input Schema

NameRequiredDescriptionDefault
chainIdNoChain ID to get tokens for (optional)
includeTestnetsNoWhether to include testnet tokens

Input Schema (JSON Schema)

{ "additionalProperties": false, "properties": { "chainId": { "description": "Chain ID to get tokens for (optional)", "oneOf": [ { "type": "number" }, { "type": "string" } ] }, "includeTestnets": { "default": false, "description": "Whether to include testnet tokens", "type": "boolean" } }, "type": "object" }

Implementation Reference

  • Core handler function in QuoteService that implements the logic to retrieve supported tokens for a specific chain or all supported chains, filtering by testnets and using getTokensForChain helper.
    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, }; }
  • MCP server handler for 'get_supported_tokens' tool that parses input arguments using Zod schema and delegates to QuoteService.getSupportedTokens.
    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/index.ts:79-98 (registration)
    Tool registration in the listTools handler, defining the name, description, and input schema for 'get_supported_tokens'.
    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, },
  • Zod schema and TypeScript type definition for the SupportedTokensRequest input used for validation in the tool handler.
    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>;
  • Helper function that retrieves the list of supported tokens (native and USDC) for a given chain using constants.
    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; }

Other Tools

Related Tools

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