Skip to main content
Glama
romudille-bit

AgentPay x402 — Economic-intelligence layer for AI Agents

pre_trade_check

Check if now is sane to enter a trade: combine orderbook slippage, funding carry, open-interest crowding, and contract security into one ok/caution/avoid verdict before sizing a position.

Instructions

One-call pre-trade sanity check: 'I want to long $X of SYMBOL — is now sane?' Combines live orderbook slippage at YOUR size, cross-exchange funding (carry cost), open-interest crowding, and contract security (GoPlus) into a single ok/caution/avoid verdict with a per-factor breakdown. Major ERC-20 addresses (LINK, UNI, ARB, OP, AAVE, PEPE, SHIB) resolve automatically; native assets (BTC, ETH, SOL, ...) report security n/a; an unrecognized token without token_address reads 'unknown' and caps the verdict at caution — an unscreened contract can never read 'ok'. Replaces four API integrations and the judgment layer on top of them. Raw component data embedded so you can apply your own thresholds.

Use when: An agent (or human) is about to enter a position and wants one verdict covering liquidity, carry, crowding, and security — instead of four raw feeds plus its own synthesis. Not for: you need a single raw factor — funding_rates, open_interest, orderbook_depth or token_security are free; you are not about to size a position. This call settles $0.01 on-chain. Returns: verdict (ok/caution/avoid), factors{liquidity,carry,crowding,security} each with level + reason, components{orderbook_depth,funding_rates,open_interest}, symbol, side, size_usd Example response: {"symbol": "ETH", "side": "long", "size_usd": 50000, "verdict": "caution", "factors": {"liquidity": {"level": "ok", "slippage_pct": 0.011, "bucket_usd": 50000, "reason": "fills within 0.011% of best ask"}, "carry": {"level": "caution", "median_funding_pct": 0.062, "annualized_pct": 67.9, "reason": "longs paying elevated funding"}, "crowding": {"level": "ok", "long_short_ratio": 1.4, "oi_change_24h_pct": 3.2, "reason": "positioning unremarkable"}, "security": {"level": "skipped", "reason": "no token_address provided"}}}

Price: $0.01 USDC per call — settles on-chain from the wallet in STELLAR_SECRET_KEY (funded mainnet Stellar account required); not read-only. Live public data, no other API key.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sideNoTrade direction (funding carry is side-aware)long
symbolYesAsset to check, e.g. 'ETH', 'BTC', 'SOL'
size_usdNoIntended position size in USD (drives the slippage check)
token_addressNoOptional ERC-20 contract address for the GoPlus security scan. Auto-resolved for major tokens; required for a full verdict on tokens the resolver doesn't know (otherwise security reads 'unknown' and caps the verdict at caution)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.3.1
    • changedInput schema / properties / token_address / description
      Previous value: -"Optional ERC-20 contract address — adds a GoPlus security scan"New value: +"Optional ERC-20 contract address for the GoPlus security scan. Auto-resolved for major tokens; required for a full verdict on tokens the resolver doesn't know (otherwise security reads 'unknown' and caps the verdict at caution)"
  2. Addedv0.3.0

TDQS

A4.8/5.0
Behavior5/5

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

Despite annotations already flagging non-read-only/open-world, the description discloses what annotations cannot: the $0.01 on-chain settlement, the required funded mainnet Stellar account in STELLAR_SECRET_KEY, no API key needed, and the fallback semantics (native assets report security n/a; unrecognized tokens read 'unknown' and cap the verdict at caution). These are real operational constraints, not restated hints.

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 one-line purpose, then clearly separated Use when / Not for / Returns / Example blocks. It is long and mildly repetitive (the $0.01 price is stated twice), but nearly every sentence carries routing, constraint, or output-shape information.

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?

Covers a complex multi-factor, paid, non-idempotent tool without an output schema by listing the return fields plus a full worked example response showing verdict, per-factor levels, and embedded raw components. An agent has enough to size inputs and interpret outputs correctly.

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 is 3. The description goes further by explaining the token_address resolution behavior — auto-resolution for named major tokens, security 'n/a' for native assets, and the caution cap for unknown tokens — which materially affects how an agent should populate that field.

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?

Opens with a concrete verb+resource and a quoted user intent ('I want to long $X of SYMBOL — is now sane?'), then enumerates the four factors it fuses. It explicitly positions itself against siblings by naming funding_rates, open_interest, orderbook_depth and token_security as the raw components it replaces.

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?

Has explicit 'Use when' and 'Not for' sections: use when about to enter a position and want one combined verdict; not for a single raw factor (naming the four free alternatives) or when not sizing a position. This is the strongest form of routing guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.