Skip to main content
Glama

Price a swap

get_swap_quote
Read-only

Price a token swap before doing it: how much of output_token the user would receive for amount of input_token, plus price impact, fees, the slippage tolerance (slippage_bps) and the least the route can deliver (minimum_output_amount_ui). Quote output_amount_ui to the user — output_amount is in the token's smallest unit. pricing_basis states what produced it. This only prices the trade. It does not move funds and nothing is submitted on-chain. Returns a quote_id that execute_swap consumes. Quotes go stale in seconds — show the numbers to the user, get their answer, and if they hesitate, quote again rather than executing an old one. Always call this before execute_swap so the user sees what they are agreeing to. If execute_swap returns pending or fill_pending, only get_swap_status can tell you it completed.

Input Schema

NameRequiredDescriptionDefault
amountYesHow much of `input_token` to spend, in whole token units (not the smallest unit).
networkNosolana
input_tokenYesContract address of the token being SPENT.
output_tokenYesContract address of the token being RECEIVED.

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already declare readOnly/destructive=false, but the description adds non-obvious traits: nothing is submitted on-chain, quotes go stale in seconds, and a `quote_id` is returned for downstream consumption by execute_swap. The staleness window is a behavioral constraint no structured field conveys.

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?

Front-loaded with purpose and the quote fields, then workflow rules. Nearly every sentence is load-bearing, but the pacing is dense and mixes three topics (return fields, safety disclaimer, cross-tool workflow) in one block.

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?

Even though an output schema exists, the description flags the two most easily misread return fields (smallest unit vs UI units) and names the lifecycle handoff via quote_id. For a read-only pricing call whose safety profile is annotation-covered, nothing an agent needs to invoke it correctly is missing.

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 75%, and the description reinforces the critical unit distinction ('`output_amount` is in the token's smallest unit' vs `output_amount_ui`) and the spend/receive direction of input vs output token. It does not explain the `network` parameter, though its const value makes that self-evident.

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?

Opens with a specific verb+resource ('Price a token swap') and immediately enumerates what the price consists of (output amount, price impact, fees, slippage, minimum output). It explicitly separates itself from execute_swap ('This only prices the trade'), so an agent can distinguish it from the sibling that actually submits.

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?

Gives explicit sequencing ('Always call this before `execute_swap`'), a re-quote rule ('if they hesitate, quote again rather than executing an old one'), and a routing rule for the ambiguous case ('If `execute_swap` returns `pending` or `fill_pending`, only `get_swap_status` can tell you it completed'). Both the when and the when-not are stated.

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.

Resources