Skip to main content
Glama
RWAValueRouter

ValueRouter MCP Server

estimate_bridge_fees

Calculate bridge transaction fees for transferring tokens between blockchain networks. Provide source and destination chain IDs with amount to estimate costs.

Instructions

Estimate fees for a bridge transaction

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fromChainIdYesSource chain ID
toChainIdYesDestination chain ID
amountYesAmount to bridge
tokenAddressNoToken address (optional, defaults to USDC)

Implementation Reference

  • Primary MCP tool handler for 'estimate_bridge_fees' that extracts arguments and delegates to QuoteService.estimateFees, handles errors and formats response.
    private async estimateBridgeFees(args: any): Promise<MCPToolResult> {
      try {
        const { fromChainId, toChainId, amount, tokenAddress } = args;
        const result = await this.quoteService.estimateFees(
          fromChainId,
          toChainId,
          amount,
          tokenAddress
        );
        return createSuccessResponse(result);
      } catch (error) {
        return createErrorResponse(
          error instanceof Error ? error.message : String(error),
          'FEE_ESTIMATION_ERROR'
        );
      }
    }
  • src/index.ts:291-323 (registration)
    Tool registration in ListTools handler, including name, description, and input schema.
    {
      name: 'estimate_bridge_fees',
      description: 'Estimate fees for a bridge transaction',
      inputSchema: {
        type: 'object',
        properties: {
          fromChainId: {
            oneOf: [
              { type: 'number' },
              { type: 'string' },
            ],
            description: 'Source chain ID',
          },
          toChainId: {
            oneOf: [
              { type: 'number' },
              { type: 'string' },
            ],
            description: 'Destination chain ID',
          },
          amount: {
            type: 'string',
            description: 'Amount to bridge',
          },
          tokenAddress: {
            type: 'string',
            description: 'Token address (optional, defaults to USDC)',
          },
        },
        required: ['fromChainId', 'toChainId', 'amount'],
        additionalProperties: false,
      },
    },
  • Core fee estimation logic called by the tool handler, computes bridge fee and gas fee, returns structured result.
    async estimateFees(
      fromChainId: SupportedChainId,
      toChainId: SupportedChainId,
      amount: string,
      tokenAddress?: string
    ): Promise<{
      bridgeFee: string;
      gasFee: string;
      totalFee: string;
    }> {
      const bridgeFee = this.calculateBridgeFee(amount);
      const gasFee = await this.estimateGasFees(fromChainId, toChainId);
      
      return {
        bridgeFee,
        gasFee,
        totalFee: (BigInt(bridgeFee) + BigInt(gasFee)).toString(),
      };
    }
  • Helper function to calculate the bridge fee based on amount and FEE_CONFIG.BRIDGE_FEE_BPS.
    private calculateBridgeFee(amount: string): string {
      const bridgeFeeAmount = (BigInt(amount) * BigInt(FEE_CONFIG.BRIDGE_FEE_BPS)) / BigInt(10000);
      return bridgeFeeAmount.toString();
    }
  • Helper function to estimate gas fees based on source chain type with hardcoded values.
    private async estimateGasFees(fromChainId: SupportedChainId, toChainId: SupportedChainId): Promise<string> {
      if (isEVMChain(fromChainId)) {
        return ethers.utils.parseEther('0.01').toString(); // ~$20-30 on mainnet
      } else if (isSolanaChain(fromChainId)) {
        return '5000'; // ~0.000005 SOL
      } else if (isSuiChain(fromChainId)) {
        return '1000000'; // ~0.001 SUI
      } else if (isCosmosChain(fromChainId)) {
        return '5000'; // varies by chain
      }
    
      return '0';
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It only states the tool estimates fees, without detailing whether this is a read-only operation, if it requires authentication, rate limits, error conditions, or what the output might look like. For a tool with no annotations, this is insufficient to inform safe and effective use.

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

Conciseness4/5

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

The description is a single, efficient sentence that directly states the tool's function without unnecessary words. It's front-loaded with the core purpose, making it easy to parse. However, it could be slightly more informative without sacrificing brevity, such as hinting at output or 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?

Given the complexity of bridge transactions, no annotations, and no output schema, the description is incomplete. It doesn't explain what the estimation returns (e.g., fee breakdown, currency), potential side effects, or how it differs from 'get_bridge_quote'. For a tool in a set with multiple related siblings, more context is needed to ensure proper 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?

The input schema has 100% description coverage, clearly documenting all parameters (fromChainId, toChainId, amount, tokenAddress) with their types and optionality. The description adds no additional semantic context beyond what the schema provides, such as format examples or usage notes. With high schema coverage, a baseline score of 3 is appropriate as the schema does the heavy lifting.

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

Purpose3/5

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

The description states the tool's purpose ('Estimate fees for a bridge transaction'), which is clear but vague. It specifies the action ('Estimate') and resource ('fees for a bridge transaction'), but doesn't differentiate from sibling tools like 'get_bridge_quote' or explain what 'bridge transaction' entails. This leaves ambiguity about scope and distinction.

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. It doesn't mention sibling tools like 'execute_bridge' or 'get_bridge_quote', nor does it specify prerequisites, constraints, or typical use cases. This lack of context makes it hard for an agent to choose appropriately among related tools.

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