Skip to main content
Glama
RWAValueRouter

ValueRouter MCP Server

execute_bridge

Simulate cross-chain USDC transfers between blockchain networks to generate transaction data for bridging operations.

Instructions

Execute a bridge transaction (simulation only - returns transaction data)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fromChainIdYesSource chain ID
toChainIdYesDestination chain ID
fromTokenYes
toTokenYes
amountYesAmount to bridge in smallest unit
recipientAddressYesRecipient address on destination chain
userAddressYesUser address initiating the transaction
slippageBpsNoSlippage tolerance in basis points
memoNoMemo for Cosmos chains (optional)

Implementation Reference

  • The primary handler for the 'execute_bridge' tool. Parses input arguments using BridgeRequestSchema, delegates to BridgeService for transaction preparation, adds simulation warning, and returns MCPToolResult.
    private async executeBridge(args: any): Promise<MCPToolResult> { try { const request = BridgeRequestSchema.parse(args); const result = await this.bridgeService.prepareBridgeTransaction(request); // Add a warning that this is simulation only return createSuccessResponse({ ...result, warning: 'This is a simulation only. To execute the transaction, use the returned transaction data with your wallet.', simulationOnly: true, }); } catch (error) { return createErrorResponse( error instanceof Error ? error.message : String(error), 'BRIDGE_ERROR' ); } }
  • src/index.ts:164-235 (registration)
    Registration of the 'execute_bridge' tool in the ListToolsRequestSchema handler, including detailed input schema definition.
    { name: 'execute_bridge', description: 'Execute a bridge transaction (simulation only - returns transaction data)', inputSchema: { type: 'object', properties: { fromChainId: { oneOf: [ { type: 'number' }, { type: 'string' }, ], description: 'Source chain ID', }, toChainId: { oneOf: [ { type: 'number' }, { type: 'string' }, ], description: 'Destination chain ID', }, fromToken: { type: 'object', properties: { address: { type: 'string' }, chainId: { oneOf: [{ type: 'number' }, { type: 'string' }] }, symbol: { type: 'string' }, name: { type: 'string' }, decimals: { type: 'number' }, logoURI: { type: 'string' }, isNative: { type: 'boolean' }, }, required: ['address', 'chainId', 'symbol', 'name', 'decimals'], }, toToken: { type: 'object', properties: { address: { type: 'string' }, chainId: { oneOf: [{ type: 'number' }, { type: 'string' }] }, symbol: { type: 'string' }, name: { type: 'string' }, decimals: { type: 'number' }, logoURI: { type: 'string' }, isNative: { type: 'boolean' }, }, required: ['address', 'chainId', 'symbol', 'name', 'decimals'], }, amount: { type: 'string', description: 'Amount to bridge in smallest unit', }, recipientAddress: { type: 'string', description: 'Recipient address on destination chain', }, userAddress: { type: 'string', description: 'User address initiating the transaction', }, slippageBps: { type: 'number', description: 'Slippage tolerance in basis points', default: 100, }, memo: { type: 'string', description: 'Memo for Cosmos chains (optional)', }, }, required: ['fromChainId', 'toChainId', 'fromToken', 'toToken', 'amount', 'recipientAddress', 'userAddress'], additionalProperties: false, }, },
  • Zod schema (BridgeRequestSchema) used for input validation in the execute_bridge handler.
    export const BridgeRequestSchema = z.object({ fromChainId: z.union([z.number(), z.string()]), toChainId: z.union([z.number(), z.string()]), fromToken: TokenSchema, toToken: TokenSchema, amount: z.string(), recipientAddress: z.string(), slippageBps: z.number().optional().default(100), userAddress: z.string(), memo: z.string().optional(), // For Cosmos chains });
  • src/index.ts:339-340 (registration)
    Dispatch case in the CallToolRequestSchema handler that routes 'execute_bridge' calls to the executeBridge method.
    case 'execute_bridge': return await this.executeBridge(args);
  • Core helper method in BridgeService that handles the bridge transaction preparation logic, dispatching to chain-specific implementations (simulation-based). Called by the main handler.
    async prepareBridgeTransaction(request: BridgeRequest): Promise<BridgeResponse> { const { fromChainId, toChainId, fromToken, toToken, amount, recipientAddress, userAddress } = request; // Cast chain IDs to proper types const fromChainIdTyped = fromChainId as SupportedChainId; const toChainIdTyped = toChainId as SupportedChainId; // Validate chain support if (!CHAIN_INFO[fromChainIdTyped] || !CHAIN_INFO[toChainIdTyped]) { throw new Error(`Unsupported chain: ${fromChainId} or ${toChainId}`); } // Validate USDC bridging (for now, we focus on USDC) if (fromToken.symbol !== 'USDC' && toToken.symbol !== 'USDC') { throw new Error('Currently only USDC bridging is supported'); } try { if (isEVMChain(fromChainIdTyped)) { return await this.prepareEVMBridge(request); } else if (isSolanaChain(fromChainIdTyped)) { return await this.prepareSolanaBridge(request); } else if (isSuiChain(fromChainIdTyped)) { return await this.prepareSuiBridge(request); } else if (isCosmosChain(fromChainIdTyped)) { return await this.prepareCosmosBridge(request); } else { throw new Error(`Unsupported source chain: ${fromChainId}`); } } catch (error) { throw new Error(`Failed to prepare bridge transaction: ${error instanceof Error ? error.message : String(error)}`); } }

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