Skip to main content
Glama

price_amm_swap

Price a DEX swap against an AMM pool to quote fill cost or measure price impact. Supports constant-product, Raydium CP, and Uniswap v3 pools using on-chain state.

Instructions

Price a DEX swap against an AMM pool, exact to the wei, through FLOX's integer curves. Use this to quote a fill or measure price impact on a constant-product (Uniswap v2), Raydium CP (Solana), or Uniswap v3 concentrated-liquidity pool from its on-chain state. Amounts are decimal strings (native wei / lamports), so 256-bit values are lossless. Requires the optional flox-py dependency.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
venueYesThe pool's AMM type.
poolYesPool parameters as decimal strings. constant_product: reserve0, reserve1, fee_num, fee_den. raydium_cp: reserve0, reserve1, trade_fee_rate. uniswap_v3: sqrt_price_x96, liquidity, fee_pips, ticks (optional [sqrtRatio, net] pairs).
amount_inYesInput amount, native wei (decimal string).
iNoIn-token index (default 0).
jNoOut-token index (default 1).
Behavior4/5

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

No annotations provided, so description carries full burden. Discloses key behaviors: exact to wei, lossless for 256-bit values, and required dependency 'flox-py'. Does not mention rate limits or side effects, but as a read-only pricing tool, this is acceptable.

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?

Four sentences, front-loaded with purpose, no fluff. Every sentence adds essential information.

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

Completeness4/5

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

Adequately describes inputs and use cases for a complex tool with nested objects and no output schema. Lacks mention of return value (likely amount_out), but context is sufficient for an AI agent to infer behavior.

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%, but description adds valuable context: explains that amounts are decimal strings in native wei/lamports, lossless, and breaks down pool parameter structures per venue. Goes beyond 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?

Clearly states the tool's purpose: pricing a DEX swap against various AMM pool types with exact precision (wei-level). Differentiates from sibling tools like 'route_amm_swap' and 'amm_price_impact'.

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?

Explicitly describes when to use: to quote a fill or measure price impact on constant-product, Raydium CP, or Uniswap v3 pools. Also mentions the required dependency. Lacks explicit exclusions but context is clear.

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/FLOX-Foundation/flox'

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