Skip to main content
Glama

get_swap_quote

Maps to POST /quote. Returns the best swap quote across all integrated DEX protocols, with router, callData, value, price impact, route summary, and gas estimate in one response. Surplus and positive slippage are returned to the user in the same transaction. Supports an optional affiliateCode (registered affiliate wallet address) forwarded to the API so the affiliate fee is paid on-chain to that address. Supports an excludePositions parameter that prices the swap excluding the caller's own LP position from pool state. Returns signable data only; never signs or broadcasts. EXECUTION FLOW: (1) If the input token is non-native, send an ERC-20 approve to the router and WAIT for on-chain confirmation. (2) Call this tool again for a fresh quote (quotes expire). (3) Send the tx to the router contract: to=router, data=callData, value=value. This requires a private key or wallet signer. ⚠️ PRICE IMPACT: The response includes a priceImpact field. Agents MUST present this value to the user and request explicit confirmation before executing. High price impact means the user will receive significantly less value than expected. ⚠️ ZERO OUTPUT: If the swap amount is too small relative to the token pair price ratio, the API returns HTTP 400 with "swap amount too small: output rounds to zero for this pair". Increase the amount or use a different pair.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sideYesQuote direction
amountYesAmount as stringified uint256 in token decimals
chainIdYesEVM chain ID (e.g. 56 for BSC)
tokenInYesInput token address (0x0000...0000 for native coin)
tokenOutYesOutput token address
slippageBpsNoSlippage tolerance in basis points (default: 100 = 1%)
affiliateCodeNoOptional affiliate wallet address registered on-chain with SwapWizard — forwarded to the API so the affiliate fee for this operation is paid to that address. Omit if you have no affiliate.
excludePositionsNoPositions to subtract from pool state during simulation — for a clean quote that excludes self-impact. Get these from list_user_lp_positions.

TDQS

A4.7/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does so excellently. It discloses that the tool returns signable data only and never signs/broadcasts, warns about quotes expiring, requires on-chain approval confirmation, mandates user confirmation for price impact, and explains the zero-output error case. These are critical behavioral traits beyond the basic function.

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 long but every sentence earns its place. It is front-loaded with the core purpose, then flows into execution steps and warnings in a clearly numbered section. The structure (EXECUTION FLOW, PRICE IMPACT, ZERO OUTPUT) makes it scannable and appropriately sized for a complex swap tool with 8 parameters and no annotations.

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?

Despite no output schema, the description lists the key response fields (router, callData, value, price impact, route summary, gas estimate). It covers prerequisites (approval), lifecycle (quotes expire), safety (price impact confirmation), and error handling (zero output 400). This is a complete contextual picture for an agent to invoke 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 baseline is 3. The description adds extra meaning for affiliateCode (how to get one, on-chain fee payment) and excludePositions (how to obtain from list_user_lp_positions, purpose of excluding self-impact). It also clarifies that amounts are stringified uint256 and native coin is zero address, but those are in schema. Overall, it supplements but does not fully replace schema knowledge.

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 opens with a specific verb+resource: 'Returns the best swap quote across all integrated DEX protocols.' It lists the concrete response fields (router, callData, value, price impact, etc.) and distinguishes this quote tool from siblings like get_clean_quote by emphasizing the complete execution payload. The purpose is immediately clear and unambiguous.

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

Usage Guidelines4/5

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

The description provides a detailed execution flow with explicit steps: approve ERC-20, call again for fresh quote, send tx with router/callData/value. It also notes the need for private key or wallet signer. It references list_user_lp_positions for excludePositions, but does not explicitly contrast with get_clean_quote or state when NOT to use this tool. Thus it gives strong context without explicit exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

TDQS

A4.5/5.0
Disambiguation5/5

Each tool has a clearly distinct purpose: health check, setup guide, chain/dex list, pool discovery, pool analysis, swap quoting (with per-use-case variant), LP position listing, and single-transaction LP entry/exit. No significant overlap.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern in snake_case (analyze_pool, get_swap_quote, list_user_lp_positions, etc.). Even 'zap_into_lp_position' and 'zap_out_of_lp_position' maintain the pattern with verbs 'zap_into' and 'zap_out_of'.

Tool Count5/5

11 tools is well-scoped for a DeFi liquidity management server covering health, discovery, quoting, and LP operations. Each tool earns its place without redundancy.

Completeness4/5

Covers core workflows: pool discovery, analysis, swap quotes, LP position management, and single-transaction zap in/out. Missing is a direct token approval tool, but instructions for approvals are embedded in relevant tools. Minor gap but highly functional.