Skip to main content
Glama

get_swap_quote

Get a swap quote for exchanging different tokens, same-chain or cross-chain, with ready-to-sign transaction steps for automated execution.

Instructions

Get a quote for swapping between DIFFERENT tokens, same-chain or cross-chain (e.g. ETH → USDC on Base, or ETH on Ethereum → USDC on Base).

Use when input and output tokens differ. Works same-chain and cross-chain. For same-token bridging (e.g. ETH on Ethereum → ETH on Base), use get_bridge_quote instead — it's simpler.

Returns execution steps — each step contains ready-to-sign transaction data (to, data, value, chainId, gas). An agent with wallet tooling can sign and submit these directly. Also returns a relay.link deep link as a fallback for manual execution.

Amounts must be in the token's smallest unit (wei, satoshis, lamports). Examples: 1 ETH = "1000000000000000000" (18 decimals), 1 USDC = "1000000" (6 decimals), 1 BTC = "100000000" (8 decimals), 1 SOL = "1000000000" (9 decimals). Use convert_amount or get_supported_tokens to look up decimals. Chain IDs can be numbers (8453) or names ('base', 'ethereum', 'arb', 'bitcoin', 'solana').

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
amountYesAmount to swap in the origin token's smallest unit. Examples: wei for ETH (18 decimals), satoshis for BTC (8 decimals), lamports for SOL (9 decimals).
senderYesSender wallet address.
refundToNoAddress to send refunds to if the swap fails. Defaults to sender.
recipientNoRecipient wallet address. Defaults to sender.
tradeTypeNoEXACT_INPUT (default): you specify input amount, output varies. EXPECTED_OUTPUT: you specify desired output, input is calculated (allows slippage). EXACT_OUTPUT: you specify exact output required, fails if not deliverable.EXACT_INPUT
includeStepsNoInclude raw transaction steps for signing. Only needed if you have wallet tooling to submit transactions directly. Omit to save tokens.
originChainIdYesSource chain ID or name (e.g. 1, 'ethereum', 'eth').
originCurrencyYesToken address or symbol to swap from. Symbols like "ETH", "USDC", "USDT", "WETH" are resolved automatically. For native tokens use: EVM "0x0000000000000000000000000000000000000000", Solana "11111111111111111111111111111111", Bitcoin "bc1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqmql8k8", Hyperliquid "0x00000000000000000000000000000000", Lighter "0". For other tokens, use the contract/mint address or look up via get_supported_tokens.
useDepositAddressNoUse deposit address flow — returns an address the user can send funds to instead of transaction calldata. No wallet signing needed. Only supports EXACT_INPUT.
destinationChainIdYesDestination chain ID or name (e.g. 8453, 'base'). Can be the same as originChainId for same-chain swaps.
destinationCurrencyYesToken address or symbol to swap to. Symbols like "ETH", "USDC", "USDT", "WETH" are resolved automatically. For native tokens use: EVM "0x0000000000000000000000000000000000000000", Solana "11111111111111111111111111111111", Bitcoin "bc1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqmql8k8", Hyperliquid "0x00000000000000000000000000000000", Lighter "0". For other tokens, use the contract/mint address or look up via get_supported_tokens.
Behavior4/5

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

No annotations exist, so the description carries full burden. It details that the tool returns execution steps with ready-to-sign transaction data and a relay.link deep link. It explains amount units and chain ID formats. However, it does not explicitly state that the operation is read-only or idempotent, though the name 'get' implies no mutation.

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 well-structured with clear sections: purpose, usage guidance, return value explanation, and parameter details. It front-loads the core purpose. While it is somewhat lengthy, the content is valuable and each sentence serves a purpose. It could be slightly more concise but is appropriate for the complexity.

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

Completeness5/5

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

Given the 11 parameters, no output schema, and no annotations, the description provides thorough context: it explains the return format (execution steps, deep link), parameter formats (amounts, chain IDs, token addresses), trade type options, and alternative flows (useDepositAddress). It also distinguishes from sibling tools. The description is nearly complete for an AI agent to use the tool correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the description adds value beyond the schema. It explains tradeType semantics in depth (EXACT_INPUT, EXPECTED_OUTPUT, EXACT_OUTPUT), provides examples for native token addresses across different blockchains, and clarifies amount units with concrete examples. This goes well beyond the schema descriptions.

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: to get a quote for swapping between DIFFERENT tokens, same-chain or cross-chain. It provides examples (ETH to USDC on Base, cross-chain) and explicitly distinguishes from get_bridge_quote for same-token bridging.

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 gives explicit 'when to use' (different tokens) and 'when not to use' (same-token bridging, for which it recommends get_bridge_quote). This provides clear context for the AI agent to select the appropriate tool.

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

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