Skip to main content
Glama

ValueRouter MCP Server

execute_bridge

Simulate cross-chain bridge transactions for USDC across blockchain networks, generating transaction data for Ethereum, Solana, Sui, and Cosmos chains. Specify source and destination chains, tokens, amounts, and recipient addresses.

Instructions

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

Input Schema

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

Input Schema (JSON Schema)

{ "additionalProperties": false, "properties": { "amount": { "description": "Amount to bridge in smallest unit", "type": "string" }, "fromChainId": { "description": "Source chain ID", "oneOf": [ { "type": "number" }, { "type": "string" } ] }, "fromToken": { "properties": { "address": { "type": "string" }, "chainId": { "oneOf": [ { "type": "number" }, { "type": "string" } ] }, "decimals": { "type": "number" }, "isNative": { "type": "boolean" }, "logoURI": { "type": "string" }, "name": { "type": "string" }, "symbol": { "type": "string" } }, "required": [ "address", "chainId", "symbol", "name", "decimals" ], "type": "object" }, "memo": { "description": "Memo for Cosmos chains (optional)", "type": "string" }, "recipientAddress": { "description": "Recipient address on destination chain", "type": "string" }, "slippageBps": { "default": 100, "description": "Slippage tolerance in basis points", "type": "number" }, "toChainId": { "description": "Destination chain ID", "oneOf": [ { "type": "number" }, { "type": "string" } ] }, "toToken": { "properties": { "address": { "type": "string" }, "chainId": { "oneOf": [ { "type": "number" }, { "type": "string" } ] }, "decimals": { "type": "number" }, "isNative": { "type": "boolean" }, "logoURI": { "type": "string" }, "name": { "type": "string" }, "symbol": { "type": "string" } }, "required": [ "address", "chainId", "symbol", "name", "decimals" ], "type": "object" }, "userAddress": { "description": "User address initiating the transaction", "type": "string" } }, "required": [ "fromChainId", "toChainId", "fromToken", "toToken", "amount", "recipientAddress", "userAddress" ], "type": "object" }

Implementation Reference

  • The primary handler function for the 'execute_bridge' tool. It validates the input arguments using BridgeRequestSchema, calls BridgeService.prepareBridgeTransaction to generate the transaction details (simulation), and returns the result with a simulation warning.
    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' ); } }
  • Core helper function in BridgeService that handles the bridge transaction preparation. Validates inputs, checks chain support and token (USDC only), and dispatches to chain-specific preparation methods (all simulations generating fake tx hashes).
    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)}`); } }
  • src/index.ts:339-340 (registration)
    Dispatch case in the CallToolRequestSchema handler that routes calls to the execute_bridge tool to the executeBridge method.
    case 'execute_bridge': return await this.executeBridge(args);
  • src/index.ts:164-235 (registration)
    Tool registration in the ListToolsRequestSchema handler, defining the 'execute_bridge' tool's name, description, and detailed inputSchema matching BridgeRequestSchema.
    { 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 definition for BridgeRequest used to parse and validate input arguments in the executeBridge 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 });

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