Skip to main content
Glama
Replaced by its MCP Registry listing

This endpoint is listed in the official MCP Registry as Ingravity Autonomous EVM Security & DeFi Guard ($0.005 x402 v2). If you published it, claim ownership there.

DeFi Slippage, MEV & Liquidation Math Guard

ingravity_computeDefiSlippageAndLiquidation
Read-onlyIdempotent

Computes deterministic 18-decimal BigInt AMM swap outputs (amm: exact amount out, price impact, and 48-step MEV sandwich bounds) and/or perp liquidation limits (leverage: liquidation price and health factor). Runs pure off-chain math with zero RPC calls or on-chain side effects; pass amm, leverage, or both (omitting both returns -32602). Fixed price per call: FULL ($0.10 USDC, default) returns complete amm and leverage metrics; ESSENTIAL ($0.04 USDC) returns PROCEED/ABORT signal only; unpaid calls return isError: true with an x402 challenge. Use for swap or leverage math; use ingravity_inspectEvmTransactionFirewall for raw calldata.

Input Schema

NameRequiredDescriptionDefault
ammNoOptional constant-product AMM swap parameters (reserveIn, reserveOut, amountIn required when included; evaluated independently of leverage; supply amm, leverage, or both).
tierNoBilling & output depth: FULL ($0.10 USDC fixed) returns exact amm and leverage structures; ESSENTIAL ($0.04 USDC fixed) returns top-level action, signal, and savedCapitalEstimateUsd only.FULL
leverageNoOptional perpetual/margin position parameters for exact liquidation price and initial health factor (entryPrice required when included; evaluated independently of amm).

Output Schema

NameRequiredDescriptionDefault
ammNoExact BigInt swap metrics and optimal MEV sandwich profitability bounds (FULL tier, when amm supplied).
actionYesTrade or margin risk gate decision.
signalYesTraffic-light execution signal.
settledYesWhether x402 USDC payment settled cleanly.
leverageNoExact liquidation price, distance-to-liquidation %, and health factor (FULL tier, when leverage supplied).
savedCapitalEstimateUsdYesEstimated MEV or liquidation loss avoided.
proportionalRescueCommissionPolicyNoBilling policy confirmation indicating full diagnostic delivery under fixed per-call pricing (FULL tier).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changed
    • changedInput schema / properties / tier / description
      Previous value: -"Billing & output depth: FULL ($0.10 USDC) returns exact amm and leverage structures; ESSENTIAL ($0.04 USDC) returns top-level action, signal, and savedCapitalEstimateUsd only."New value: +"Billing & output depth: FULL ($0.10 USDC fixed) returns exact amm and leverage structures; ESSENTIAL ($0.04 USDC fixed) returns top-level action, signal, and savedCapitalEstimateUsd only."
    • changedOutput schema / properties / amm / description
      Previous value: -"Exact BigInt swap metrics and optimal MEV sandwich profitability bounds (FULL tier only, when amm supplied)."New value: +"Exact BigInt swap metrics and optimal MEV sandwich profitability bounds (FULL tier, when amm supplied)."
    • changedOutput schema / properties / leverage / description
      Previous value: -"Exact liquidation price, distance-to-liquidation %, and health factor (FULL tier only, when leverage supplied)."New value: +"Exact liquidation price, distance-to-liquidation %, and health factor (FULL tier, when leverage supplied)."
    • changedOutput schema / properties / proportionalRescueCommissionPolicy / description
      Previous value: -"0.15% Pre-Flight swap and 5%-10% Safe-Harbor terms (FULL tier only)."New value: +"Billing policy confirmation indicating full diagnostic delivery under fixed per-call pricing (FULL tier)."
  2. Changed1 schema field changed
    • addedInput schema / anyOf
      Added value: +[
      +  {
      +    "required": [
      +      "amm"
      +    ]
      +  },
      +  {
      +    "required": [
      +      "leverage"
      +    ]
      +  }
      +]
  3. Changed1 schema field changed
    • changedInput schema / properties / tier / description
      Previous value: -"Billing & output depth: FULL ($0.15 USDC) returns exact amm and leverage structures; ESSENTIAL ($0.10 USDC) returns top-level action, signal, and savedCapitalEstimateUsd only."New value: +"Billing & output depth: FULL ($0.10 USDC) returns exact amm and leverage structures; ESSENTIAL ($0.04 USDC) returns top-level action, signal, and savedCapitalEstimateUsd only."
  4. Changed27 schema fields changed
    • addedInput schema / properties / amm / description
      Added value: +"Optional constant-product AMM swap parameters (reserveIn, reserveOut, amountIn required when included; evaluated independently of leverage; supply amm, leverage, or both)."
    • changedInput schema / properties / amm / properties / amountIn / description
      Previous value: -"Swap input amount in atomic units"New value: +"Proposed swap input amount in atomic base units as a positive integer string (> 0)."
    • addedInput schema / properties / amm / properties / estimatedSandwichGasInTokenIn
      Added value: +{
      +  "default": "0",
      +  "description": "Optional attacker gas cost in input token atomic units (>= 0) used to filter unprofitable sandwich attacks.",
      +  "type": "string"
      +}
    • addedInput schema / properties / amm / properties / feeBps / default
      Added value: +30
    • changedInput schema / properties / amm / properties / feeBps / description
      Previous value: -"Pool fee in basis points (default 30 = 0.30%)"New value: +"Pool fee in basis points (0-9999; 30 = 0.30%)."
    • addedInput schema / properties / amm / properties / feeBps / maximum
      Added value: +9999
    • addedInput schema / properties / amm / properties / feeBps / minimum
      Added value: +0
    • changedInput schema / properties / amm / properties / reserveIn / description
      Previous value: -"Pool input token reserve in atomic units"New value: +"Pool input token reserve in atomic base units as a positive integer string (> 0)."
    • changedInput schema / properties / amm / properties / reserveOut / description
      Previous value: -"Pool output token reserve in atomic units"New value: +"Pool output token reserve in atomic base units as a positive integer string (> 0)."
    • addedInput schema / properties / amm / properties / userSlippageBps / default
      Added value: +100
    • changedInput schema / properties / amm / properties / userSlippageBps / description
      Previous value: -"Proposed slippage tolerance in bps (e.g. 100 = 1%)"New value: +"Proposed slippage tolerance in basis points (0-9999; 100 = 1.00%)."
    • addedInput schema / properties / amm / properties / userSlippageBps / maximum
      Added value: +9999
    • addedInput schema / properties / amm / properties / userSlippageBps / minimum
      Added value: +0
    • addedInput schema / properties / leverage / description
      Added value: +"Optional perpetual/margin position parameters for exact liquidation price and initial health factor (entryPrice required when included; evaluated independently of amm)."
    • changedInput schema / properties / leverage / properties / entryPrice / description
      Previous value: -"Entry asset price (e.g. '2500.00')"New value: +"Position entry price as a positive decimal string with up to 18 decimals (e.g., '2500.00')."
    • addedInput schema / properties / leverage / properties / feeBufferBps
      Added value: +{
      +  "default": 10,
      +  "description": "Fee buffer in basis points deducted from initial margin (0-9999; 10 = 0.10%).",
      +  "maximum": 9999,
      +  "minimum": 0,
      +  "type": "integer"
      +}
    • addedInput schema / properties / leverage / properties / leverage / default
      Added value: +"1"
    • changedInput schema / properties / leverage / properties / leverage / description
      Previous value: -"Leverage multiplier (e.g. '10')"New value: +"Leverage multiplier as a decimal string between '1' and '1000' (e.g., '10')."
    • addedInput schema / properties / leverage / properties / maintenanceMarginBps / default
      Added value: +50
    • changedInput schema / properties / leverage / properties / maintenanceMarginBps / description
      Previous value: -"Maintenance margin in bps (default 50)"New value: +"Maintenance margin threshold in basis points (0-9999; 50 = 0.50%)."
    • addedInput schema / properties / leverage / properties / maintenanceMarginBps / maximum
      Added value: +9999
    • addedInput schema / properties / leverage / properties / maintenanceMarginBps / minimum
      Added value: +0
    • addedInput schema / properties / leverage / properties / side / default
      Added value: +"LONG"
    • addedInput schema / properties / leverage / properties / side / description
      Added value: +"Position direction: LONG or SHORT."
    • addedInput schema / properties / leverage / required
      Added value: +[
      +  "entryPrice"
      +]
    • addedInput schema / properties / tier
      Added value: +{
      +  "default": "FULL",
      +  "description": "Billing & output depth: FULL ($0.15 USDC) returns exact amm and leverage structures; ESSENTIAL ($0.10 USDC) returns top-level action, signal, and savedCapitalEstimateUsd only.",
      +  "enum": [
      +    "FULL",
      +    "ESSENTIAL"
      +  ],
      +  "type": "string"
      +}
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "additionalProperties": true,
      +  "properties": {
      +    "action": {
      +      "description": "Trade or margin risk gate decision.",
      +      "enum": [
      +        "PROCEED",
      +        "ABORT_HIGH_MEV_RISK",
      +        "ABORT_CRITICAL_LIQUIDATION_RISK"
      +      ],
      +      "type": "string"
      +    },
      +    "amm": {
      +      "additionalProperties": true,
      +      "description": "Exact BigInt swap metrics and optimal MEV sandwich profitability bounds (FULL tier only, when amm supplied).",
      +      "type": "object"
      +    },
      +    "leverage": {
      +      "additionalProperties": true,
      +      "description": "Exact liquidation price, distance-to-liquidation %, and health factor (FULL tier only, when leverage supplied).",
      +      "type": "object"
      +    },
      +    "proportionalRescueCommissionPolicy": {
      +      "additionalProperties": true,
      +      "description": "0.15% Pre-Flight swap and 5%-10% Safe-Harbor terms (FULL tier only).",
      +      "type": "object"
      +    },
      +    "savedCapitalEstimateUsd": {
      +      "description": "Estimated MEV or liquidation loss avoided.",
      +      "type": "string"
      +    },
      +    "settled": {
      +      "description": "Whether x402 USDC payment settled cleanly.",
      +      "type": "boolean"
      +    },
      +    "signal": {
      +      "description": "Traffic-light execution signal.",
      +      "enum": [
      +        "GREEN_LIGHT",
      +        "RED_LIGHT"
      +      ],
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "settled",
      +    "action",
      +    "signal",
      +    "savedCapitalEstimateUsd"
      +  ],
      +  "type": "object"
      +}
  5. First observed

TDQS

A4.4/5.0
Behavior5/5

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

Adds substantial context beyond the annotations: pure off-chain math with zero RPC calls, deterministic 18-decimal BigInt arithmetic, an explicit -32602 error when both inputs are omitted, fixed per-call pricing across FULL/ESSENTIAL tiers, and unpaid-call behavior (isError with x402 challenge). This materially exceeds what readOnly/idempotent hints convey.

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-loaded with the core capability, then constraints, then pricing and routing. It is dense but every clause carries information (error code, billing, off-chain guarantee). A single long paragraph with several semicolon clauses makes it slightly harder to scan, but nothing is wasteful.

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?

Given an output schema exists and annotations cover the safety profile, the description supplies everything else an agent needs: input combination rules, the omission error code, pricing tiers and their output-depth difference, and payment failure behavior. Nothing critical is left undocumented for this complexity level.

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 coverage is 100%, so the schema already documents all three parameters including tier semantics and defaults. The description reinforces the amm/leverage grouping and maps each group to its outputs, but adds little param-level meaning (formats, ranges, validation) that the schema does not already carry. Baseline 3 is appropriate.

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 ('Computes') with two concrete resources — AMM swap outputs and perp liquidation limits — and enumerates the actual outputs (exact amount out, price impact, 48-step MEV bounds; liquidation price, health factor). It also names the sibling it replaces for raw calldata, so an agent can differentiate without opening schemas.

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 when-to-use ('Use for swap or leverage math') and an explicit alternative ('use ingravity_inspectEvmTransactionFirewall for raw calldata'). It also clarifies that amm, leverage, or both may be supplied. It lacks exclusions for the other sibling tools (rugpull scan, contract audit), but the routing guidance for its own domain is clear.

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