Skip to main content
Glama

Execute a previewed order

execute_previewed_order
DestructiveIdempotent

Execute a preview from preview_perp_order: re-checked at a fresh price, then sent to the exchange with its stop-loss placed there. Use only after a successful preview. Not for new or changed orders (preview again). If a person must approve (propose level, or no trade:execute scope) it waits; wait_seconds (0-30) holds the call open for the decision. Inputs: preview_id, client_order_id (idempotency key: repeating it returns the first result). A fill cannot be undone; the remedy is close_perp_position_reduce_only. Next: get_order_request_status(request_id) while pending.

Input Schema

NameRequiredDescriptionDefault
preview_idYesFrom preview_perp_order, within 30 seconds
wait_secondsNoIf the order needs a person's approval, wait up to this long for the decision before returning
client_order_idYesYour idempotency key, unique per agent; repeating it returns the first result instead of a second order

Output Schema

NameRequiredDescriptionDefault
okYesFalse when rejected or failed
feeNoOnce executed: the trading fee, estimated at once and replaced by the amount the exchange charged once its fill records show it
legsNoA ladder entry: per leg {price, size_base, order_id, sl_oid, status}; status resting, or after a refused leg withdrawn, filled or partly_filled
errorNoWhy it was rejected or failed
venueNoVenue name
checksNoChecks run at execution
sl_oidNoVenue order id of the protective stop
statusYespending_approval, armed (a trigger entry waiting for its price), executed, rejected, failed, expired, declined, cancelled, or executing (TradeHub has not confirmed the outcome yet: check get_order_request_status)
receiptNoSigned receipt (compact JWS, EdDSA) once executed: request, checks, preview price, fill, slippage, order ids, delegation. Verify with /.well-known/tradehub-receipts.jwks
order_idNoVenue order id of the fill
fill_priceNoAverage fill, USD per coin
request_idYesOrder request id; get_order_request_status(request_id) follows it
deprecationNoPresent only while this tool is deprecated: replacement, removal_date, changelog
filled_sizeNoFilled size, in the base coin (e.g. BTC), not USD
take_profitsNoset_take_profit_levels: the take-profits now on the exchange
trigger_priceNostatus armed: opens at market when the mark reaches this, USD per coin
trigger_expires_atNostatus armed: when it lapses unless reached, ISO 8601 UTC
approval_expires_atNoWhile pending: when the approval request lapses, ISO 8601 UTC

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedOutput schema / properties / legs
      Added value: +{
      +  "anyOf": [
      +    {
      +      "items": {
      +        "additionalProperties": true,
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "A ladder entry: per leg {price, size_base, order_id, sl_oid, status}; status resting, or after a refused leg withdrawn, filled or partly_filled",
      +  "title": "Legs"
      +}
  2. Changed2 schema fields changed
    • addedOutput schema / $defs / FeeOut
      Added value: +{
      +  "additionalProperties": true,
      +  "properties": {
      +    "actual": {
      +      "anyOf": [
      +        {
      +          "type": "number"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "description": "The charged amount in asset; negative = a rebate",
      +      "title": "Actual"
      +    },
      +    "actual_usd": {
      +      "anyOf": [
      +        {
      +          "type": "number"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "description": "What the exchange charged, USD; null until its fill records show it (or when charged in another asset, see actual and asset)",
      +      "title": "Actual Usd"
      +    },
      +    "asset": {
      +      "anyOf": [
      +        {
      +          "type": "string"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "description": "The asset it was charged in (USDT, USDC, BNB …)",
      +      "title": "Asset"
      +    },
      +    "deprecation": {
      +      "anyOf": [
      +        {
      +          "additionalProperties": true,
      +          "type": "object"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "default": null,
      +      "description": "Present only while this tool is deprecated: replacement, removal_date, changelog",
      +      "title": "Deprecation"
      +    },
      +    "estimated_usd": {
      +      "anyOf": [
      +        {
      +          "type": "number"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "description": "The account's rate x the filled notional, USD",
      +      "title": "Estimated Usd"
      +    },
      +    "kind": {
      +      "description": "open or close",
      +      "title": "Kind",
      +      "type": "string"
      +    },
      +    "status": {
      +      "description": "pending (not read yet), done, or unknown (the exchange never showed it)",
      +      "title": "Status",
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "kind",
      +    "estimated_usd",
      +    "actual_usd",
      +    "actual",
      +    "asset",
      +    "status"
      +  ],
      +  "title": "FeeOut",
      +  "type": "object"
      +}
    • addedOutput schema / properties / fee
      Added value: +{
      +  "anyOf": [
      +    {
      +      "$ref": "#/$defs/FeeOut"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "Once executed: the trading fee, estimated at once and replaced by the amount the exchange charged once its fill records show it"
      +}
  3. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already flag destructive/openWorld/idempotent, but the description adds substantive context beyond them: the order is re-checked at a fresh price, the stop-loss is placed at the exchange, a human approval path may block, wait_seconds bounds that wait to 0-30s, and a fill is irreversible with close_perp_position_reduce_only as the remedy. That is exactly the kind of risk and side-effect detail annotations cannot carry.

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 action and the safety-critical 'cannot be undone' note, and every sentence carries new information. The heavy parenthetical style and fragment sentences make it dense to parse, which keeps it from a 5.

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 destructive, human-approval-gated execution tool it covers prerequisites, the approval flow, timeout bounds, idempotency, irreversibility with a remedy, and the next polling call. An output schema exists, so return-value detail is correctly omitted.

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 earns an extra point by framing preview_id as freshness-bound and client_order_id as an idempotency key whose repetition returns the first result rather than placing a second order. Much of this duplicates the schema text, so it stops short of 5.

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+resource ('Execute a preview from preview_perp_order') and immediately scopes it: re-priced then sent to the exchange with the stop-loss placed there. It explicitly distinguishes itself from the preview sibling and from order creation, so an agent can pick it over preview_perp_order or amend_open_entry_order without opening a 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 hard preconditions ('Use only after a successful preview'), an explicit exclusion ('Not for new or changed orders (preview again)'), and a follow-up path ('Next: get_order_request_status(request_id) while pending'). It also explains the approval branch and how wait_seconds selects between waiting and returning immediately.

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