Skip to main content
Glama

gdex_preview_trade

Read-only

Generate a trade preview without trading that turns an explicit trade intent into exact terms and returns a previewId for gdex_execute_trade; supports spot, perp open, and perp close.

Instructions

Turn an explicit trade intent into exact executable terms without trading: market, side, human and raw amounts, quote source and time, minimum received or limit price, funding plan, expiry (60s). Returns a previewId for gdex_execute_trade. kind=spot (USDC wallet), perp_open, perp_close. For perps give notionalUsd (position size) or marginUsd (collateral), never guess which.

Input Schema

NameRequiredDescriptionDefault
dexNoperp_close: builder DEX for a bare coin
coinNoperp: e.g. BTC, or xyz:TSLA for builder DEXes
kindYes
sideNospot: buy|sell; perp_open: long|short
sizeNoperp_close: contracts to close (omit = full)
chainNospot: chain name or id
amountNospot: USDC to spend (buy) or token amount (sell)
slPriceNoperp_open stop-loss
tpPriceNoperp_open take-profit
leverageNoperp_open: leverage (backend: cross on core perps, isolated on builder-DEX markets)
marginUsdNoperp_open: collateral in USD
orderTypeNo
accountRefYesFrom gdex_connect
limitPriceNoperp_open limit price
autoFundingNospot buy: bridge USDC/gas from other chains (default true)
notionalUsdNoperp_open: position size in USD
slippagePctNospot: max slippage %, default 1, max 5
tokenAddressNospot: token contract / mint

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv5.1.0

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true and openWorldHint=true, so the safety profile is covered. The description adds behavior beyond annotations: a 60-second expiry, the returned previewId, and confirmation that no trade occurs. These are concrete, useful traits for an agent planning a trade.

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?

Three sentences, front-loaded with the core purpose and return value. Dense but every clause contributes needed information. Slightly run-on first sentence, but no wasted words.

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?

For a tool with 18 parameters and no output schema, the description covers the return value (previewId) and the most ambiguous parameter choices (kind, notionalUsd vs marginUsd). The schema carries the rest, so the description is sufficiently complete for correct invocation.

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 description coverage is 89%, so the baseline is 3. The description adds critical guidance that isn't fully captured in the schema: it distinguishes notionalUsd (position size) from marginUsd (collateral) for perps and warns 'never guess which,' and clarifies the meaning of kind values (spot uses USDC wallet).

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-resource: 'Turn an explicit trade intent into exact executable terms without trading.' Explicitly distinguishes itself from the execution sibling by noting it returns a previewId for gdex_execute_trade. An agent can immediately tell this is a preview/simulation tool, not an execution tool.

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?

Names the alternative (gdex_execute_trade) and implies the workflow: preview first, then execute. Provides kind options (spot, perp_open, perp_close) and a rule for perps (give notionalUsd or marginUsd, never guess which). Lacks an explicit 'when not to use' exclusion, but the context is clear.

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

Deploy Server

Other Tools