Skip to main content
Glama

defi impermanent loss

defi_impermanent_loss
Read-only

Impermanent loss for a liquidity position: for a price move (percent, or entry and current price) get the value in the pool versus simply holding, the loss in percent and money, and the fee APR needed to break even, or whether the fees you pass already cover it. Handles 50/50 constant-product pools, weighted pools (80/20) and Uniswap v3 concentrated ranges, where it also says whether you are still in range. $0.002. Costs $0.002 USDC per call (x402).

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": "defi_impermanent_loss"
  }
}

Input Schema

NameRequiredDescriptionDefault
daysNo
weightNo% of the volatile token for weighted pools, default 50
depositNoposition value at entry, default 1000
fee_aprNo
entry_priceNo
current_priceNo
range_lower_percentNov3 range below entry, e.g. -20
range_upper_percentNov3 range above entry, e.g. 25
price_change_percentNoe.g. 60 or -40

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.1/5.0
Behavior3/5

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

Annotations already declare this is a read-only, open-world operation, and the description correctly behaves like a pure computation with no side effects. It adds genuinely useful non-schema behavior: a per-call cost of $0.002 USDC enforced via x402, and the fact that for v3 ranges the response reports whether the position is still in range. That pricing/auth detail is valuable, but the price is stated twice and no error or edge-case behavior (e.g., out-of-range positions, zero-fee scenarios) is described.

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 core capability is front-loaded in one dense sentence, followed by the supported pool models. Nearly every clause earns its place, but the trailing '$0.002. Costs $0.002 USDC per call (x402).' repeats the same price twice and reads as bolted-on rather than integrated.

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?

There is no output schema, so the description carries the return-value burden — and it does, spelling out pool value, hold value, loss percent, loss amount, break-even fee APR, and v3 in-range status. Combined with read-only annotations and a mostly explained schema, an agent has enough to invoke it correctly; the undocumented 'days' parameter and absent defaults/edge cases are the remaining gaps.

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?

With 56% schema coverage and 9 optional parameters, the description compensates well: it explains the two mutually exclusive ways to express the price move (price_change_percent vs. entry_price/current_price), that weighted-pool math is driven by the volatile-token share (matching the weight param's 80/20 example), and that the v3 range parameters define a band the position may have exited. Only 'days' is left entirely unexplained in both description and schema.

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?

Names a specific analytical quantity (impermanent loss) for a specific resource (a liquidity position) and enumerates exactly what it returns: pool value vs. holding, loss in percent and money, and break-even fee APR. It also scopes the supported pool models (50/50, weighted 80/20, Uniswap v3 ranges), so an agent can tell at a glance this is a pool-loss calculator rather than a generic DeFi data lookup like the defi_tvl or defi_yields siblings.

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 clear conditions for use: any time you have a price move expressed either as a percent or as entry plus current price, and any time the pool is constant-product, weighted, or v3 concentrated. It stops short of stating exclusions (e.g., that it cannot price non-linear/staked or multi-asset LP structures) or naming an alternative tool for those cases, which keeps it below a 5.

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