Skip to main content
Glama
omnioperand-mcp

omnioperand-mcp

omni_impermanent_loss_amm

Calculate exact impermanent loss and dollar divergence for Uniswap, SushiSwap, or PancakeSwap constant-product liquidity positions using deposit amount and price ratio.

Instructions

Automated Market Maker (AMM) Impermanent Loss Calculator. Calculate exact impermanent loss (IL) for liquidity providers on Uniswap, SushiSwap, and PancakeSwap constant-product (x·y=k) pools. Discipline: CRYPTO. Governing mathematical model / formula: IL = 2 · √k / (1 + k) - 1 | where k = Price Ratio (P_new / P_initial).

USAGE GUIDELINES:

  • WHEN TO USE: Invoke for deterministic calculation of impermanent_loss_pct (Impermanent Loss Percentage), current_pool_value (Current Value in AMM Pool), hodl_value_usd (Value If Held (HODL Strategy)), net_dollar_divergence (Opportunity Cost Lost to Arbitrage) using initial_deposit_usd (Initial Liquidity Deposit ($ USD)), price_change_ratio (Price Multiplier of Token A relative to B (k) in x (e.g. 2x = 100% gain)). Guarantees exact machine floating-point precision, eliminating LLM arithmetic mistakes and formula hallucinations.

  • WHEN NOT TO USE: Do not use for qualitative evaluations or unquantified reasoning. All input parameters must be valid numerical values.

DISAMBIGUATION & BOUNDARIES:

  • Use this dedicated specialist tool for 'Automated Market Maker (AMM) Impermanent Loss Calculator' rather than generic dispatchers like omni_universal_query.

  • For multi-calculation chained jobs, use 'omni_batch_calculate'.

  • To inspect schema fields, see 'omni_describe_solver'.

BEHAVIOR & SAFETY:

  • Pure deterministic computation with machine floating-point precision.

  • Read-only, idempotent, and stateless. Zero side effects or persistent state mutations.

  • Input validation: All arguments are validated against physical and domain bounds. Out-of-bounds inputs return a safe diagnostic error status without throwing runtime exceptions.

RETURNS:

  • Structured JSON object containing:

    • status (string): "success" on valid execution or "error" if validation fails

    • calculator (string): "impermanent-loss-amm"

    • category (string): "crypto"

    • name (string): "Automated Market Maker (AMM) Impermanent Loss Calculator"

    • formula (string): Governing mathematical formula string

    • inputs (object): Echoed input parameter dictionary with applied defaults

    • metrics (object): Dictionary of computed outputs:

      • metrics.impermanent_loss_pct (Impermanent Loss Percentage): Formatted display string (e.g. '-5.72%')

      • metrics.current_pool_value (Current Value in AMM Pool): Formatted display string (e.g. '$13,333.33')

      • metrics.hodl_value_usd (Value If Held (HODL Strategy)): Formatted display string (e.g. '$14,142.14')

      • metrics.net_dollar_divergence (Opportunity Cost Lost to Arbitrage): Formatted display string (e.g. '-$808.81')

    • execution_time_ms (number): Latency in milliseconds.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "omni_impermanent_loss_amm"
  }
}

Input Schema

NameRequiredDescriptionDefault
price_change_ratioNoPrice Multiplier of Token A relative to B (k) (x (e.g. 2x = 100% gain)). Relative price shift between pool assets. Default: 2. Min: 0.05. Max: 20.
initial_deposit_usdNoInitial Liquidity Deposit ($ USD). Total 50/50 token pair value deposited into pool. Default: 10000. Min: 100. Max: 1000000.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.1.2

TDQS

A4.8/5.0
Behavior5/5

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

With no annotations supplied, the description carries the full burden and does so: read-only, idempotent, stateless, zero side effects, domain-bounded input validation, and out-of-bounds inputs returning a diagnostic error status rather than throwing. It also discloses precision behavior (machine floating-point, no LLM arithmetic), which is exactly the trait that motivates using the tool.

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 definition is front-loaded with purpose and formula, then cleanly sectioned into usage, disambiguation, behavior, and returns. Some category boilerplate ('Discipline: CRYPTO', echoing the calculator name back in the returns block) is redundant, but nothing is genuinely misleading or wasteful enough to hurt usability.

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?

There is no output schema, and the description compensates by fully documenting the response envelope (status, calculator, category, formula, inputs, metrics with formatted-string examples, execution_time_ms). For a two-parameter deterministic calculator, an agent has everything needed to call it and interpret the result.

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 description coverage is 100%, so the baseline would be 3, but the description adds meaning beyond the schema by defining k mathematically as P_new / P_initial and tying each parameter to the metric it drives (e.g. initial_deposit_usd → pool/HODL values). The explanation is distributed across the usage and formula sections rather than consolidated per-parameter, which keeps it just short of a 5.

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 names a specific verb and resource ('Calculate exact impermanent loss (IL) for liquidity providers') and scopes it to constant-product x·y=k pools on named DEXes, with the governing formula given inline. It is immediately distinguishable from the many unrelated '*_loss' siblings in the catalog.

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?

It provides explicit WHEN TO USE (deterministic IL computation with enumerated inputs/outputs), WHEN NOT TO USE (qualitative or non-numeric reasoning), and DISAMBIGUATION routing to omni_universal_query, omni_batch_calculate, and omni_describe_solver. The conditions that select an alternative are stated, not implied.

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

Deploy Server

Other Tools