Skip to main content
Glama
RWAValueRouter

ValueRouter MCP Server

get_bridge_quote

Obtain a quote for bridging USDC or other tokens between blockchain networks by specifying source and destination chains, tokens, and amount.

Instructions

Get a quote for bridging USDC or other tokens between chains

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fromChainIdYesSource chain ID
toChainIdYesDestination chain ID
fromTokenYes
toTokenYes
amountYesAmount to bridge in smallest unit (wei, lamports, etc.)
slippageBpsNoSlippage tolerance in basis points (100 = 1%)
userAddressNoUser address for better quote accuracy (optional)

Implementation Reference

  • Core handler function in QuoteService that computes the bridge quote, including fee calculations, slippage adjustment, and simulated routing.
    async getQuote(request: QuoteRequest): Promise<QuoteResponse> {
      const { fromChainId, toChainId, fromToken, toToken, amount, slippageBps = 100 } = request;
      const fromChainIdTyped = fromChainId as SupportedChainId;
      const toChainIdTyped = toChainId as SupportedChainId;
    
      // Validate chains
      if (!CHAIN_INFO[fromChainIdTyped] || !CHAIN_INFO[toChainIdTyped]) {
        throw new Error(`Unsupported chain: ${fromChainId} or ${toChainId}`);
      }
    
      // Calculate bridge fees
      const bridgeFeeAmount = this.calculateBridgeFee(amount);
      const estimatedGas = await this.estimateGasFees(fromChainIdTyped, toChainIdTyped);
    
      // For now, we'll simulate quote calculation
      // In production, this would call actual DEX aggregators and bridge services
      const quote = await this.calculateQuote(
        fromChainIdTyped,
        toChainIdTyped,
        fromToken,
        toToken,
        amount,
        slippageBps
      );
    
      const toAmountBig = BigInt(quote.toAmount);
      const slippageAmount = (toAmountBig * BigInt(slippageBps)) / BigInt(10000);
      const toAmountMin = (toAmountBig - slippageAmount).toString();
    
      return {
        fromChainId,
        toChainId,
        fromToken,
        toToken,
        fromAmount: amount,
        toAmount: quote.toAmount,
        toAmountMin,
        bridgeFee: bridgeFeeAmount,
        gasFee: estimatedGas,
        totalFee: (BigInt(bridgeFeeAmount) + BigInt(estimatedGas)).toString(),
        estimatedTime: this.estimateCompletionTime(fromChainIdTyped, toChainIdTyped),
        priceImpact: quote.priceImpact,
        route: quote.route,
        validUntil: Date.now() + 60 * 1000, // 1 minute
      };
    }
  • MCP tool handler wrapper that parses input using QuoteRequestSchema and delegates to QuoteService.getQuote.
    private async getBridgeQuote(args: any): Promise<MCPToolResult> {
      try {
        const request = QuoteRequestSchema.parse(args);
        const result = await this.quoteService.getQuote(request);
        return createSuccessResponse(result);
      } catch (error) {
        return createErrorResponse(
          error instanceof Error ? error.message : String(error),
          'QUOTE_ERROR'
        );
      }
    }
  • Zod schema for validating the input parameters of the get_bridge_quote tool.
    export const QuoteRequestSchema = z.object({
      fromChainId: z.union([z.number(), z.string()]),
      toChainId: z.union([z.number(), z.string()]),
      fromToken: TokenSchema,
      toToken: TokenSchema,
      amount: z.string(), // Amount in smallest unit (wei, lamports, etc.)
      slippageBps: z.number().optional().default(100), // 1% default slippage
      userAddress: z.string().optional(), // For better quote accuracy
    });
  • src/index.ts:100-163 (registration)
    Tool registration in ListTools handler, defining name, description, and input schema for get_bridge_quote.
    {
      name: 'get_bridge_quote',
      description: 'Get a quote for bridging USDC or other tokens between chains',
      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 (wei, lamports, etc.)',
          },
          slippageBps: {
            type: 'number',
            description: 'Slippage tolerance in basis points (100 = 1%)',
            default: 100,
          },
          userAddress: {
            type: 'string',
            description: 'User address for better quote accuracy (optional)',
          },
        },
        required: ['fromChainId', 'toChainId', 'fromToken', 'toToken', 'amount'],
        additionalProperties: false,
      },
    },
  • Key helper method that simulates the quote calculation for direct USDC bridges or swap+bridge routes.
    private async calculateQuote(
      fromChainId: SupportedChainId,
      toChainId: SupportedChainId,
      fromToken: Token,
      toToken: Token,
      amount: string,
      slippageBps: number
    ): Promise<{
      toAmount: string;
      priceImpact: string;
      route: { steps: { type: "swap" | "bridge"; chainId: SupportedChainId; fromToken: Token; toToken: Token; amount: string; protocol: string; }[]; };
    }> {
      // For USDC-to-USDC bridging, it's 1:1 minus fees
      if (fromToken.symbol === 'USDC' && toToken.symbol === 'USDC') {
        const bridgeFee = this.calculateBridgeFee(amount);
        const toAmount = (BigInt(amount) - BigInt(bridgeFee)).toString();
        
        return {
          toAmount,
          priceImpact: '0.01', // 1% for bridge fee
          route: {
            steps: [{
              type: "bridge",
              chainId: fromChainId,
              fromToken,
              toToken,
              amount,
              protocol: "ValueRouter"
            }]
          },
        };
      }
    
      // For other token swaps, we'd need to call external APIs
      // For now, simulate with some basic calculations
      const mockToAmount = (BigInt(amount) * BigInt(95) / BigInt(100)).toString(); // 5% slippage simulation
      
      return {
        toAmount: mockToAmount,
        priceImpact: '0.05', // 5% price impact
        route: {
          steps: [
            {
              type: "swap",
              chainId: fromChainId,
              fromToken,
              toToken: { ...toToken, chainId: fromChainId },
              amount,
              protocol: "DEX"
            },
            {
              type: "bridge",
              chainId: toChainId,
              fromToken: { ...toToken, chainId: fromChainId },
              toToken,
              amount: mockToAmount,
              protocol: "ValueRouter"
            }
          ]
        },
      };
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. While it indicates this is a quote operation (implying read-only), it doesn't specify whether this requires authentication, has rate limits, returns time-sensitive data, or what format the quote will be in. The description is minimal and lacks important behavioral context for a financial tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that communicates the core purpose without unnecessary words. It's appropriately sized for what it does convey, though it could benefit from additional context.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a complex financial tool with 7 parameters (including nested objects), no annotations, and no output schema, the description is insufficient. It doesn't explain what the quote includes (fees, estimated time, success probability), how long quotes remain valid, or what format the response will take. The description leaves too many questions unanswered for proper agent usage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 71% schema description coverage, the baseline is 3. The description mentions 'bridging USDC or other tokens between chains' which provides some context for the fromToken/toToken parameters, but doesn't add meaningful semantics beyond what the schema already documents for the 7 parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get a quote') and resource ('bridging USDC or other tokens between chains'), providing a specific verb+resource combination. However, it doesn't explicitly differentiate this quote tool from the sibling 'estimate_bridge_fees' tool, which might serve a similar purpose.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'estimate_bridge_fees' or 'execute_bridge'. There's no mention of prerequisites, timing considerations, or when this tool would be preferred over other bridge-related tools in the server.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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