Skip to main content
Glama

Ingravity Autonomous EVM Security & DeFi Guard (x402 v2)

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). Set tier to FULL ($0.10 USDC, default) for full metrics or ESSENTIAL ($0.04 USDC) for PROCEED/ABORT signal only; unpaid calls return isError: true with an x402 challenge (0.15%/5%-10% rescue fees apply only when settling exposed live-capital rescues). 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) returns exact amm and leverage structures; ESSENTIAL ($0.04 USDC) 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 only, 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 only, when leverage supplied).
savedCapitalEstimateUsdYesEstimated MEV or liquidation loss avoided.
proportionalRescueCommissionPolicyNo0.15% Pre-Flight swap and 5%-10% Safe-Harbor terms (FULL tier only).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.7/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true, idempotentHint=true, destructiveHint=false, and openWorldHint=false, so the safety profile is covered; the description still adds real value by stating the math is pure off-chain with zero RPC calls and no on-chain side effects. It also discloses billing behavior (FULL $0.10 vs ESSENTIAL $0.04, unpaid calls return isError: true with an x402 challenge) and conditional rescue fees, which annotations cannot express. It stops short of describing result shape or determinism caveats in depth.

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?

Front-loads the core computation, then the off-chain guarantee, then branching, pricing, and the sibling alternative in descending priority. Dense but every clause carries information an agent needs; no filler or restatement of the title.

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?

For a zero-required-parameter tool with two independent nested branches, an output schema, and full annotation coverage, the description covers inputs, branch behavior, cost tiers, failure modes, and routing. Nothing an agent needs to invoke it correctly appears to be 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 the baseline is 3; the description earns above that by explaining what tier actually changes in output depth (FULL returns exact structures, ESSENTIAL returns action, signal, savedCapitalEstimateUsd) and by reporting the -32602 outcome when both optional branches are omitted. It does not add unit or format guidance beyond what the nested schema already documents.

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 two concrete computational resources (AMM swap outputs with exact amount out, price impact, and 48-step MEV sandwich bounds; perp liquidation price and health factor), including numeric precision (18-decimal BigInt). It explicitly distinguishes itself from ingravity_inspectEvmTransactionFirewall for raw calldata, so an agent can route correctly without opening the schema.

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

Usage Guidelines5/5

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

Gives explicit selection rules: pass amm, leverage, or both, and notes that omitting both yields -32602. It names the sibling alternative and the condition that selects it (raw calldata inspection), leaving little to inference.

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.