Skip to main content
Glama
quoteSwap.ts3.95 kB
import { z } from "zod"; import { DeBridgeClient } from "../debridgeClient"; const client = new DeBridgeClient(); /** * MCP Tool: Cross-chain swap quote via deBridge DLN. * Supports preview mode (no addresses) and full mode (with addresses for complete order creation). */ export const quoteSwapTool = { name: "quoteSwap", description: "Get cross-chain swap quote via deBridge DLN. Preview mode (omit addresses) returns estimation only. Full mode (with addresses) returns complete order with transaction data.", inputSchema: z.object({ srcChainId: z .string() .describe("Source chain ID, e.g. '56' for BSC, '42161' for Arbitrum"), srcToken: z .string() .describe("Token address on source chain (ERC20)"), amount: z .string() .describe("Amount in smallest units (wei / token decimals)"), dstChainId: z .string() .describe("Destination chain ID, e.g. '1' for Ethereum, '43114' for Avalanche"), dstToken: z .string() .describe("Token address on destination chain (ERC20)"), senderAddress: z .string() .optional() .describe("Sender's wallet address (enables full order creation with tx data)"), dstChainTokenOutRecipient: z .string() .optional() .describe("Recipient address on destination chain (defaults to senderAddress)"), srcChainOrderAuthorityAddress: z .string() .optional() .describe("Order authority on source chain (defaults to senderAddress)"), dstChainOrderAuthorityAddress: z .string() .optional() .describe("Order authority on destination chain (defaults to dstChainTokenOutRecipient)"), referralCode: z .string() .optional() .describe("Referral code for rewards tracking"), affiliateFeePercent: z .number() .optional() .describe("Affiliate fee in basis points (e.g., 0.1 = 10 bps = 0.1%)"), affiliateFeeRecipient: z .string() .optional() .describe("Address to receive affiliate fees (required if affiliateFeePercent is set)") }), handler: async (input: { srcChainId: string; srcToken: string; amount: string; dstChainId: string; dstToken: string; senderAddress?: string; dstChainTokenOutRecipient?: string; srcChainOrderAuthorityAddress?: string; dstChainOrderAuthorityAddress?: string; referralCode?: string; affiliateFeePercent?: number; affiliateFeeRecipient?: string; }) => { const dlnData = await client.fetchQuote({ srcChainId: input.srcChainId, srcToken: input.srcToken, amount: input.amount, dstChainId: input.dstChainId, dstToken: input.dstToken, senderAddress: input.senderAddress, dstChainTokenOutRecipient: input.dstChainTokenOutRecipient, referralCode: input.referralCode, affiliateFeePercent: input.affiliateFeePercent, affiliateFeeRecipient: input.affiliateFeeRecipient }); return { summary: { srcChainId: input.srcChainId, dstChainId: input.dstChainId, estimatedDstAmount: dlnData.estimation?.dstChainTokenOut?.amount ?? null, feeBps: dlnData.feeBps ?? null, takerRewardBps: dlnData.additionalTakerRewardBps ?? null }, tokens: { srcToken: { address: input.srcToken, symbol: dlnData.estimation?.srcChainTokenIn?.symbol ?? null, decimals: dlnData.estimation?.srcChainTokenIn?.decimals ?? null }, dstToken: { address: input.dstToken, symbol: dlnData.estimation?.dstChainTokenOut?.symbol ?? null, decimals: dlnData.estimation?.dstChainTokenOut?.decimals ?? null } }, txPreview: { to: dlnData.tx?.to ?? null, data: dlnData.tx?.data ?? null, value: dlnData.tx?.value ?? null }, estimation: dlnData.estimation ?? null, raw: dlnData }; } };

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/RookieCol/debridge-mcp'

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