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). 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).

Input Schema

TableJSON 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

A4.6/5.0
Behavior5/5

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

Annotations already declare this is a safe, non-destructive, closed-world read, and the description adds substantial behavior beyond that: sign invariant (impermanentLossPct is always <= 0), normalization frame (relative to the quote token, dimensionless), the concentration caveat (IL worse than full_range when tight, position becomes fully single-asset and fee-less once price exits the range), and the stable-quote assumption behind the optional USD figures.

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-loads the core definition and mode split before the trigger phrasing and return list, and nearly every clause carries information. It is a single dense block with the textbook closed form noted parenthetically, which is arguably more formula detail than an agent needs to select the tool.

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 but a 7-parameter, mode-dependent computation, the description compensates by listing the returned fields (impermanentLossPct, lpValueMultiplier, hodlValueMultiplier, inRange, lossUsd/netResultUsd) and noting when they are null. Mode requirements and range constraints are covered between description and schema, leaving no material gap for invocation.

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 the baseline is 3, but the description adds genuine meaning the schema lacks: what 'mode' actually selects between, why the concentrated bounds change the economics, and what the dollar outputs assume. It does not restate the schema's own constraints verbatim, which is the right call.

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?

States a specific verb and resource ('Impermanent loss for a liquidity-pool position: compares providing liquidity against simply holding the same tokens') and enumerates the two computation modes with their distinct formulas. The phrase 'manually-supplied entry and current price' implicitly separates it from the sibling workflow.run_impermanent_loss_live, so an agent can route between them without opening either schema.

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?

Gives concrete user-facing triggers ('how much am I losing to impermanent loss?', 'is this LP position still worth it after fees?'), which tells the agent when to select it. It does not state exclusions or name the live variant as the alternative for auto-fetched prices, so it stops short of full when/when-not routing.

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.