Skip to main content
Glama

get_relay_app_url

Generate a deep link to open the Relay web app with pre-filled bridge or swap parameters, enabling users to start new cross-chain transactions directly in their browser.

Instructions

Generate a deep link to the Relay web app with pre-filled bridge/swap parameters. The user can open this URL in their browser to START a new transaction via the Relay UI. This is NOT a transaction tracking URL — do NOT use it to check on an in-progress transaction. For tracking, use get_transaction_status with the requestId.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
destinationChainIdYesDestination chain ID (e.g. 8453 for Base). This determines the Relay app page.
fromChainIdNoOrigin chain ID (e.g. 1 for Ethereum). If omitted, user picks in the UI.
fromCurrencyNoOrigin token address. "0x0000000000000000000000000000000000000000" for native.
toCurrencyNoDestination token address. "0x0000000000000000000000000000000000000000" for native.
amountNoPre-filled input amount in human-readable units (e.g. "0.1" for 0.1 ETH).
toAddressNoRecipient wallet address.
tradeTypeNoTrade type. Defaults to EXACT_INPUT.

Implementation Reference

  • Main handler function for get_relay_app_url tool. Calls buildRelayAppUrl helper to generate the deep link URL, validates the result, and returns the URL to the user. Returns an error if the chain ID is invalid.
    async ({ destinationChainId, fromChainId, fromCurrency, toCurrency, amount, toAddress, tradeType }) => {
      const url = await buildRelayAppUrl({
        destinationChainId,
        fromChainId,
        fromCurrency,
        toCurrency,
        amount,
        toAddress,
        tradeType,
      });
    
      if (!url) {
        return {
          content: [
            {
              type: "text",
              text: `Error: Chain ID ${destinationChainId} not found. Use get_supported_chains to find valid chain IDs.`,
            },
          ],
          isError: true,
        };
      }
    
      const summary = `Open this link to complete the transaction in the Relay app: ${url}`;
    
      return {
        content: [
          { type: "text", text: summary },
          {
            type: "text",
            text: JSON.stringify({ url }, null, 2),
          },
        ],
      };
    }
  • Zod schema defining the input parameters for the get_relay_app_url tool. Includes required destinationChainId and optional parameters: fromChainId, fromCurrency, toCurrency, amount, toAddress, and tradeType (enum: EXACT_INPUT, EXPECTED_OUTPUT, EXACT_OUTPUT).
      destinationChainId: z
        .number()
        .describe("Destination chain ID (e.g. 8453 for Base). This determines the Relay app page."),
      fromChainId: z
        .number()
        .optional()
        .describe("Origin chain ID (e.g. 1 for Ethereum). If omitted, user picks in the UI."),
      fromCurrency: z
        .string()
        .optional()
        .describe('Origin token address. "0x0000000000000000000000000000000000000000" for native.'),
      toCurrency: z
        .string()
        .optional()
        .describe('Destination token address. "0x0000000000000000000000000000000000000000" for native.'),
      amount: z
        .string()
        .optional()
        .describe("Pre-filled input amount in human-readable units (e.g. \"0.1\" for 0.1 ETH)."),
      toAddress: z
        .string()
        .optional()
        .describe("Recipient wallet address."),
      tradeType: z
        .enum(["EXACT_INPUT", "EXPECTED_OUTPUT", "EXACT_OUTPUT"])
        .optional()
        .describe("Trade type. Defaults to EXACT_INPUT."),
    },
  • Registration function that registers the get_relay_app_url tool with the MCP server. Defines the tool name, description, schema, and handler function.
    export function register(server: McpServer) {
      server.tool(
        "get_relay_app_url",
        "Generate a deep link to the Relay web app with pre-filled bridge/swap parameters. The user can open this URL in their browser to START a new transaction via the Relay UI. This is NOT a transaction tracking URL — do NOT use it to check on an in-progress transaction. For tracking, use get_transaction_status with the requestId.",
        {
          destinationChainId: z
            .number()
            .describe("Destination chain ID (e.g. 8453 for Base). This determines the Relay app page."),
          fromChainId: z
            .number()
            .optional()
            .describe("Origin chain ID (e.g. 1 for Ethereum). If omitted, user picks in the UI."),
          fromCurrency: z
            .string()
            .optional()
            .describe('Origin token address. "0x0000000000000000000000000000000000000000" for native.'),
          toCurrency: z
            .string()
            .optional()
            .describe('Destination token address. "0x0000000000000000000000000000000000000000" for native.'),
          amount: z
            .string()
            .optional()
            .describe("Pre-filled input amount in human-readable units (e.g. \"0.1\" for 0.1 ETH)."),
          toAddress: z
            .string()
            .optional()
            .describe("Recipient wallet address."),
          tradeType: z
            .enum(["EXACT_INPUT", "EXPECTED_OUTPUT", "EXACT_OUTPUT"])
            .optional()
            .describe("Trade type. Defaults to EXACT_INPUT."),
        },
        async ({ destinationChainId, fromChainId, fromCurrency, toCurrency, amount, toAddress, tradeType }) => {
          const url = await buildRelayAppUrl({
            destinationChainId,
            fromChainId,
            fromCurrency,
            toCurrency,
            amount,
            toAddress,
            tradeType,
          });
    
          if (!url) {
            return {
              content: [
                {
                  type: "text",
                  text: `Error: Chain ID ${destinationChainId} not found. Use get_supported_chains to find valid chain IDs.`,
                },
              ],
              isError: true,
            };
          }
    
          const summary = `Open this link to complete the transaction in the Relay app: ${url}`;
    
          return {
            content: [
              { type: "text", text: summary },
              {
                type: "text",
                text: JSON.stringify({ url }, null, 2),
              },
            ],
          };
        }
      );
  • src/index.ts:12-12 (registration)
    Import statement for the get_relay_app_url tool registration function.
    import { register as registerGetRelayAppUrl } from "./tools/get-relay-app-url.js";
  • src/index.ts:28-28 (registration)
    Registration call that registers the get_relay_app_url tool with the MCP server instance.
    registerGetRelayAppUrl(server);
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively explains that this tool generates a URL for users to open in their browser to initiate transactions via the UI, which is valuable context beyond what the schema provides. However, it doesn't mention potential rate limits, authentication requirements, or error conditions.

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 perfectly concise and front-loaded. The first sentence states the core purpose, the second explains the user action, and the third provides critical usage guidance with a clear alternative. Every sentence earns its place with no wasted words.

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

Completeness4/5

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

For a tool with 7 parameters, no annotations, and no output schema, the description does well by clearly explaining the tool's purpose, usage context, and behavioral characteristics. However, it doesn't describe what the generated URL looks like or provide examples of the output format, which would be helpful given the lack of output schema.

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?

Schema description coverage is 100%, so the schema already documents all 7 parameters thoroughly. The description doesn't add any additional parameter semantics beyond what's in the schema, but it does provide context about how the parameters are used ('pre-filled bridge/swap parameters'). This meets the baseline expectation when schema coverage is high.

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 clearly states the tool's purpose: 'Generate a deep link to the Relay web app with pre-filled bridge/swap parameters.' It specifies the exact action (generate a deep link) and resource (Relay web app), and distinguishes it from sibling tools by explicitly contrasting it with get_transaction_status for tracking purposes.

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

Usage Guidelines5/5

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

The description provides explicit guidance on when to use this tool ('to START a new transaction via the Relay UI') and when not to use it ('do NOT use it to check on an in-progress transaction'). It also names a specific alternative tool for tracking purposes: 'For tracking, use get_transaction_status with the requestId.'

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/relayprotocol/relay-mcp'

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