Skip to main content
Glama

AMM constant-product x*y=k swap calculator ($0.01)

amm_constant_product_calc
Idempotent

[Paid x402 / X-Bazaar-Key: 0.01 USDC] Compute Uniswap v2 constant-product swap output, effective price, fee deduction, and price impact percentage.

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

Input Schema

NameRequiredDescriptionDefault
amount_inNoSwap input token amount

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A3.8/5.0
Behavior4/5

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

The description discloses the paid x402 / X-Bazaar-Key access requirement and price (0.01 USDC), which is genuine behavioral context that also explains the non-read-only annotation on an otherwise pure computation tool. It does not describe failure modes (missing key, insufficient balance) or return formatting, keeping it below 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.

Conciseness4/5

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

A single dense sentence plus a bracketed cost tag, with no filler. The payment tag sits first rather than after the purpose statement, which is slightly less front-loaded for an agent scanning for capability.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description does state the computed outputs, which partly compensates for the absent output schema. However, for a paid tool it omits the critical input requirement (reserves), the fee-tier assumption (0.3% v2), and any note on units, leaving an agent likely to call it with insufficient inputs.

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?

With one parameter at 100% schema coverage, the schema already carries the semantics and baseline 3 applies. The description adds no format detail for amount_in (string decimals vs. wei) and, notably, never explains that pool reserves must also be supplied even though only amount_in is declared and additionalProperties is open — a gap the description does not close.

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 (compute), a specific model (Uniswap v2 constant-product x*y=k), and enumerates exactly what it returns: swap output, effective price, fee deduction, and price impact percentage. That combination is clearly distinguishable from sibling auditors/linters like defi_unsigned_swap_calldata_linter or lending_health_factor.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is only implied by the name and model reference — an agent can infer this is for v2-style AMM swap math, but the description never says when to prefer it over v3/v4 siblings or when it is inappropriate (e.g., concentrated liquidity positions). The only explicit prerequisite disclosed is the payment requirement.

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