get_trade_dapp_url
Generate a deBridge app URL to continue cross-chain token swaps in your browser. This tool creates links for completing trades across different blockchain networks after you've identified tokens and chains.
Instructions
Generate a deBridge app URL that redirects the user to continue a cross-chain swap in the browser. Use search_tokens to resolve token names to addresses and get_supported_chains for chain IDs before calling this tool.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| inputChain | Yes | Source chain ID. Examples: '1' (Ethereum), '56' (BNB Chain), '137' (Polygon), '7565164' (Solana) | |
| outputChain | Yes | Destination chain ID. Examples: '1' (Ethereum), '56' (BNB Chain), '42161' (Arbitrum) | |
| inputCurrency | No | Token address on the source chain. Leave empty for the chain's native token (ETH, BNB, etc.) | |
| outputCurrency | No | Token address on the destination chain. Leave empty for the chain's native token | |
| amount | Yes | Human-readable amount to swap (e.g. '1.5', '100'). NOT in smallest units — use decimal notation | |
| dlnMode | No | DLN mode: 'simple' (default) or 'advanced' | simple |
Implementation Reference
- src/tools/get-trade-dapp-url.ts:39-57 (handler)The handler function that executes the get_trade_dapp_url tool logic. It constructs a deBridge app URL using the provided parameters (inputChain, outputChain, inputCurrency, outputCurrency, amount, dlnMode) and returns the URL as text content.
async (params) => { const url = new URL(DEBRIDGE_APP_BASE); url.searchParams.set("inputChain", params.inputChain); url.searchParams.set("outputChain", params.outputChain); url.searchParams.set("inputCurrency", params.inputCurrency); url.searchParams.set("outputCurrency", params.outputCurrency); url.searchParams.set("amount", params.amount); url.searchParams.set("dlnMode", params.dlnMode); return { content: [ { type: "text" as const, text: url.toString(), }, ], }; }, - src/tools/get-trade-dapp-url.ts:6-59 (registration)The registerGetTradeDappUrl function that registers the tool with the MCP server, including the input schema definition (zod validation for inputChain, outputChain, inputCurrency, outputCurrency, amount, and dlnMode) and the handler function.
export function registerGetTradeDappUrl(server: McpServer) { server.registerTool( "get_trade_dapp_url", { description: "Generate a deBridge app URL that redirects the user to continue a cross-chain swap in the browser. Use search_tokens to resolve token names to addresses and get_supported_chains for chain IDs before calling this tool.", inputSchema: { inputChain: z .string() .describe("Source chain ID. Examples: '1' (Ethereum), '56' (BNB Chain), '137' (Polygon), '7565164' (Solana)"), outputChain: z .string() .describe("Destination chain ID. Examples: '1' (Ethereum), '56' (BNB Chain), '42161' (Arbitrum)"), inputCurrency: z .string() .optional() .default("") .describe("Token address on the source chain. Leave empty for the chain's native token (ETH, BNB, etc.)"), outputCurrency: z .string() .optional() .default("") .describe("Token address on the destination chain. Leave empty for the chain's native token"), amount: z .string() .describe("Human-readable amount to swap (e.g. '1.5', '100'). NOT in smallest units — use decimal notation"), dlnMode: z .string() .optional() .default("simple") .describe("DLN mode: 'simple' (default) or 'advanced'"), }, }, async (params) => { const url = new URL(DEBRIDGE_APP_BASE); url.searchParams.set("inputChain", params.inputChain); url.searchParams.set("outputChain", params.outputChain); url.searchParams.set("inputCurrency", params.inputCurrency); url.searchParams.set("outputCurrency", params.outputCurrency); url.searchParams.set("amount", params.amount); url.searchParams.set("dlnMode", params.dlnMode); return { content: [ { type: "text" as const, text: url.toString(), }, ], }; }, ); } - Input schema validation using zod for the get_trade_dapp_url tool parameters, including descriptions and default values for inputChain, outputChain, inputCurrency, outputCurrency, amount, and dlnMode.
inputSchema: { inputChain: z .string() .describe("Source chain ID. Examples: '1' (Ethereum), '56' (BNB Chain), '137' (Polygon), '7565164' (Solana)"), outputChain: z .string() .describe("Destination chain ID. Examples: '1' (Ethereum), '56' (BNB Chain), '42161' (Arbitrum)"), inputCurrency: z .string() .optional() .default("") .describe("Token address on the source chain. Leave empty for the chain's native token (ETH, BNB, etc.)"), outputCurrency: z .string() .optional() .default("") .describe("Token address on the destination chain. Leave empty for the chain's native token"), amount: z .string() .describe("Human-readable amount to swap (e.g. '1.5', '100'). NOT in smallest units — use decimal notation"), dlnMode: z .string() .optional() .default("simple") .describe("DLN mode: 'simple' (default) or 'advanced'"), }, - src/server.ts:39-39 (registration)The registration call that invokes registerGetTradeDappUrl to register the tool with the MCP server instance.
registerGetTradeDappUrl(server);