Skip to main content
Glama

bridge_route

Read-only

Calculate optimal cross-chain transfer route between two chains using source and destination chain IDs, token denominations, and amount in minimal units.

Instructions

Find the optimal cross-chain transfer route between two chains.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
amountYesTransfer amount in minimal denomination
sourceChainIdYesSource chain ID
sourceDenomYesSource token denomination
destChainIdYesDestination chain ID
destDenomYesDestination token denomination
networkNoNetwork to use. Defaults to mainnet.

Implementation Reference

  • Core handler for the 'bridge_route' tool. Retrieves the provider from chainManager and calls provider.bridge.route() with source/dest chain IDs and denoms to find the optimal cross-chain transfer route. Returns the route as JSON.
    registry.register({
      name: 'bridge_route',
      group: 'bridge',
      description: 'Find the optimal cross-chain transfer route between two chains.',
      schema: {
        amount: z.string().describe('Transfer amount in minimal denomination'),
        sourceChainId: z.string().describe('Source chain ID'),
        sourceDenom: z.string().describe('Source token denomination'),
        destChainId: z.string().describe('Destination chain ID'),
        destDenom: z.string().describe('Destination token denomination'),
        network: networkParam,
      },
      annotations: { readOnlyHint: true },
      handler: async ({ amount, sourceChainId, sourceDenom, destChainId, destDenom, network }, { chainManager }) => {
        const provider = await chainManager.getProvider(network);
        const route = await provider.bridge.route({
          amount,
          source: { chainId: sourceChainId, denom: sourceDenom },
          dest: { chainId: destChainId, denom: destDenom },
        });
        return success(route);
      },
    });
  • Input schema for bridge_route: amount (string), sourceChainId, sourceDenom, destChainId, destDenom (all strings), and network (optional mainnet/testnet). Uses Zod validation.
    registry.register({
      name: 'bridge_route',
      group: 'bridge',
      description: 'Find the optimal cross-chain transfer route between two chains.',
      schema: {
        amount: z.string().describe('Transfer amount in minimal denomination'),
        sourceChainId: z.string().describe('Source chain ID'),
        sourceDenom: z.string().describe('Source token denomination'),
        destChainId: z.string().describe('Destination chain ID'),
        destDenom: z.string().describe('Destination token denomination'),
        network: networkParam,
      },
      annotations: { readOnlyHint: true },
      handler: async ({ amount, sourceChainId, sourceDenom, destChainId, destDenom, network }, { chainManager }) => {
        const provider = await chainManager.getProvider(network);
        const route = await provider.bridge.route({
          amount,
          source: { chainId: sourceChainId, denom: sourceDenom },
          dest: { chainId: destChainId, denom: destDenom },
        });
        return success(route);
      },
    });
  • Registration of the 'bridge_route' tool via registry.register() in src/tools/bridge.ts. The file is side-effect imported via src/tools/index.ts.
    registry.register({
      name: 'bridge_route',
  • CLI formatter for bridge_route output. Renders route details including source/dest, amounts, estimated duration, and operations list.
    // bridge_route
    // ---------------------------------------------------------------------------
    
    function formatBridgeRoute(data: unknown): string | undefined {
      if (!isRecord(data)) return undefined;
    
      const source = pick(data, 'source', 'srcChainId', 'src_chain_id');
      const dest = pick(data, 'dest', 'dstChainId', 'dst_chain_id');
      const operations = data.operations;
      const amountIn = pick(data, 'amountIn', 'amount_in');
      const amountOut = pick(data, 'amountOut', 'amount_out');
      const durationSecs = pick(data, 'estimatedDurationSeconds', 'estimated_duration_seconds', 'duration');
    
      if (source === undefined && dest === undefined && !Array.isArray(operations)) return undefined;
    
      const lines: string[] = [];
    
      const srcStr = source !== undefined ? String(source) : '?';
      const dstStr = dest !== undefined ? String(dest) : '?';
      lines.push(pc.bold(`Route: ${srcStr} \u2192 ${dstStr}`));
    
      if (amountIn !== undefined || amountOut !== undefined) {
        const inStr = amountIn !== undefined ? formatAmountToken(amountIn) : '?';
        const outStr = amountOut !== undefined ? formatAmountToken(amountOut) : '?';
        lines.push(`  ${pc.dim('Amount  ')} ${inStr} \u2192 ${outStr}`);
      }
    
      if (durationSecs !== undefined) {
        lines.push(`  ${pc.dim('Duration')} ~${formatNumber(String(durationSecs))}s`);
      }
    
      if (Array.isArray(operations) && operations.length > 0) {
        lines.push(`  ${pc.dim('Operations:')}`);
        for (let i = 0; i < operations.length; i++) {
          const op = operations[i];
          if (isRecord(op)) {
            const opType = String(op.type ?? op.action ?? op.kind ?? 'op');
            const detail = op.channel ?? op.pool ?? op.poolId ?? op.pool_id ?? op.dex ?? op.bridge;
            const detailStr = detail !== undefined ? ` (${detail})` : '';
            lines.push(`    ${i + 1}. ${opType}${detailStr}`);
          } else {
            lines.push(`    ${i + 1}. ${String(op)}`);
          }
        }
      }
    
      return lines.join('\n');
    }
  • Registration of the bridge_route formatter via registerFormatter('bridge_route', formatBridgeRoute) for CLI display.
    registerFormatter('account_get', formatAccountGet);
    registerFormatter('tx_get', formatTxGet);
    registerFormatter('bridge_route', formatBridgeRoute);
    registerFormatter('delegation_get', formatDelegationGet);
Behavior2/5

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

Although annotations mark the tool as readOnlyHint=true, the description does not add further behavioral context. It fails to disclose that the tool returns an optimal route (without specifying optimization criteria), whether multiple routes are returned, or any rate-limiting or authentication requirements.

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, front-loaded sentence with no wasted words. It efficiently states the core purpose. However, it could be slightly expanded to include key behavioral details without becoming verbose.

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?

Without an output schema, the description should explain what the tool returns (e.g., route steps, fees, estimated time). It does not mention the default network (mainnet) or that the route is hypothetical and not executed. This leaves significant gaps for an agent to correctly invoke and interpret the tool.

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?

Given 100% schema coverage, the baseline is 3. The description adds no extra meaning to the parameters beyond what the schema already provides (e.g., 'amount in minimal denomination', 'source/dest chain ID'). It does not clarify what 'optimal' means in relation to the parameters or how the network parameter affects results.

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

Purpose5/5

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

The description uses the specific verb 'Find' and clearly identifies the resource as 'optimal cross-chain transfer route' between two chains. This distinguishes it from other bridge-related tools such as bridge_deposit or bridge_execute, which perform actions rather than querying for routes.

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 bridge_routable_assets. It does not mention prerequisites, such as needing to know chain IDs or token denominations beforehand, nor does it clarify that the tool is read-only and does not execute transfers.

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/initia-labs/mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server