Skip to main content
Glama

TradingCalc MCP: Options, Forex, Risk Stats, Prediction Markets, On-Chain & Crypto Futures

Impermanent Loss

workflow.run_impermanent_loss
Read-only

Impermanent loss for a liquidity-pool position: compares providing liquidity against simply holding the same tokens, at a manually-supplied entry and current price. Two modes: full_range (standard 50/50 constant-product pool, the textbook 2*sqrt(k)/(1+k)-1 closed form) or concentrated (a Uniswap-V3-style position confined to [lowerPrice, upperPrice] - IL is always worse than full_range for the same price move when the range is tight, and the position is fully single-asset, no longer earning fees, once price exits the range). impermanentLossPct is always <= 0 and is measured relative to the quote token (dimensionless, exact regardless of what the quote token is); the optional dollar figures additionally assume the quote token's own USD price stayed roughly stable (true for a stablecoin-quoted pool). Edge cases: entryPrice and currentPrice above zero; concentrated mode needs both lowerPrice and upperPrice with lowerPrice below entryPrice and entryPrice below upperPrice; depositValueUsd above zero and feesEarnedUsd 0 or more are optional, and dollar figures are null without a deposit. Not covered: price moves inside the period, rebalancing, gas, tax, and a quote token whose own USD price moves (dollar figures assume it is stable). Use when user asks "how much am I losing to impermanent loss?" or "is this LP position still worth it after fees?". Returns: impermanentLossPct, lpValueMultiplier, hodlValueMultiplier, inRange, lossUsd/netResultUsd (null unless depositValueUsd given).

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "entryPrice": "<entryPrice>",
      "currentPrice": "<currentPrice>"
    },
    "name": "workflow.run_impermanent_loss"
  }
}

Input Schema

NameRequiredDescriptionDefault
modeNoDefault full_range.
entryPriceYesBase token's price in quote-token terms when liquidity was deposited
lowerPriceNoRange lower bound - required for concentrated mode, must be below entryPrice
upperPriceNoRange upper bound - required for concentrated mode, must be above entryPrice
currentPriceYesBase token's current price in quote-token terms
feesEarnedUsdNoOptional trading fees earned so far in USD (default 0), folded into netResultUsd alongside lossUsd
depositValueUsdNoOptional: USD value deposited at entry, to also report dollar-denominated lpValueUsd/hodlValueUsd/lossUsd

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A3.7/5.0
Behavior3/5

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

Annotations already declare readOnly, non-destructive, and closed-world, so the safety profile is handled. The description adds real behavioral context beyond that: the closed-form model, the single-asset/out-of-range behavior of concentrated positions, the sign constraint on impermanentLossPct, and a list of omitted factors (fees drift, rebalancing, gas, tax, quote-token USD movement). This is closer to a 4 than a 3, but the disclosure is model documentation rather than tool behavior; nothing is said about determinism, precision, or failure modes when inputs violate the stated constraints.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

It is front-loaded sensibly — purpose, then modes, then invariants, then edge cases, then exclusions, then outputs — but it is long and the edge-case sentence duplicates validation rules already present in the input schema, which is wasted text. The mode and out-of-range explanation earns its place; the constraint recap does not.

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?

With no output schema, the description carries the return contract and does so fully: impermanentLossPct, lpValueMultiplier, hodlValueMultiplier, inRange, and the conditionally-null lossUsd/netResultUsd. Combined with the explicit non-coverage list and the concentrated-vs-full-range distinction, an agent has everything needed to call this correctly and to report results accurately.

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

Parameters3/5

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

Schema description coverage is 100%, so the baseline is 3, and the description largely restates schema-documented constraints (entry/current above zero, lowerPrice below entryPrice, upperPrice above it, depositValueUsd optional). It does add genuine meaning beyond the schema by explaining that impermanentLossPct is quote-token-relative and dimensionless, and that dollar outputs assume the quote token's own USD price is stable, which is not in any parameter description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description names a specific quantity (impermanent loss) and its subject (a liquidity-pool position), and states the comparison basis: providing liquidity versus holding the same tokens at a manually-supplied entry and current price. The word 'manually-supplied' implicitly separates it from the sibling run_impermanent_loss_live, but that sibling is never named, so the differentiation is inferred rather than declared.

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?

It gives concrete user-phrasing triggers ('how much am I losing to impermanent loss?', 'is this LP position still worth it after fees?'), which is stronger than most siblings' guidance. What is missing is explicit routing: no statement that live-price variants should use run_impermanent_loss_live, and no statement of when this model is inappropriate beyond the 'Not covered' list.

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.