Skip to main content
Glama

Lp Position Math

lp_position_math
Read-onlyIdempotent

Impermanent loss, hold-vs-pool value and basis split for a two-asset constant-product pool. FREE.

Typical input {"deposit": {"asset_a": "ETH", "qty_a": "1", "price_a": "2000", "asset_b": "USDC", "qty_b": "2000", "price_b": "1"}, "current_prices": {"ETH": "3000", "USDC": "1"}} returns {"il_pct": "-2.02", "hold_value": "5000.00", "pool_value": "4898.98", "deposit_value": "4000.00", "basis_split": {...}}. The pool value assumes x*y=k with no fees; add fees_earned_fiat to see the net. The basis split is the deposit's fiat value at deposit, allocated by each side's share, which is the arithmetic a lot engine needs if the LP position is treated as one asset. Use for DeFi position reviews. Not a determination of whether the deposit is a taxable exchange. Errors: on invalid, missing, or malformed input this tool never raises a protocol error; it returns {"error": ""} (for example {"error": "deposit and current_prices must be objects"}). Every call is read-only and idempotent, so after correcting the input it is always safe to retry.

Input Schema

NameRequiredDescriptionDefault
depositYesasset_a, qty_a, price_a, asset_b, qty_b, price_b at the time of deposit.
current_pricesYes{asset: price} for both assets now.
fees_earned_fiatNofees accrued to the position, in fiat.

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.1/5.0
Behavior4/5

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

Beyond the annotations it discloses the valuation model (x*y=k, no fees by default, fees_earned_fiat for net), the error contract (never raises, returns an {"error": ...} object), and retry safety. The read-only/idempotent sentence repeats the annotations rather than adding to them, which keeps this from a 5.

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?

Purpose is front-loaded in the opening sentence, followed by a minimal worked example, then assumptions, then error semantics. The example JSON is verbose but carries real structural information the schema lacks.

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?

Nested input shape, valuation assumptions, fee handling, and the non-raising error contract are all covered, which is what an agent needs for a 3-parameter nested tool. The inline return-value example is partly redundant given an output schema exists, but nothing essential is missing.

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 baseline would be 3, but the embedded example concretely shows the nested key names and value formats inside deposit and current_prices that the schema only gestures at with additionalProperties. It also explains what fees_earned_fiat does to the result, which is more than the schema's one-line 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 first sentence names the three computations (impermanent loss, hold-vs-pool value, basis split) and the domain (two-asset constant-product pool), which is far more specific than the name 'lp_position_math' alone. It does not explicitly distinguish itself from siblings like build_lots or ledger_lint, but the computational scope is unambiguous.

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?

'Use for DeFi position reviews' gives a clear usage context, and 'Not a determination of whether the deposit is a taxable exchange' is an explicit exclusion. It stops short of naming an alternative tool or stating the conditions that would route an agent elsewhere.

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.