Skip to main content
Glama

Execute a previewed order

execute_previewed_order
DestructiveIdempotent

Execute a preview from preview_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_position. Next: get_order_status(request_id) while pending.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "preview_id": "<preview_id>",
      "client_order_id": "<client_order_id>"
    },
    "name": "execute_previewed_order"
  }
}

Input Schema

NameRequiredDescriptionDefault
preview_idYesFrom preview_order, before its expires_at
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_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
cancelledNocancel_order with all_waiting_entries: the order ids withdrawn (venue ids and req_… trigger entries); [] when nothing was waiting
fill_priceNoAverage fill, USD per coin
request_idYesOrder request id; get_order_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_profits: 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
    • changedInput schema / properties / preview_id / description
      Previous value: -"From preview_order, within 30 seconds"New value: +"From preview_order, before its expires_at"
  2. Changed5 schema fields changed
    • changedInput schema / properties / preview_id / description
      Previous value: -"From preview_perp_order, within 30 seconds"New value: +"From preview_order, within 30 seconds"
    • addedOutput schema / properties / cancelled
      Added value: +{
      +  "description": "cancel_order with all_waiting_entries: the order ids withdrawn (venue ids and req_… trigger entries); [] when nothing was waiting",
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": [
      +    "array",
      +    "null"
      +  ]
      +}
    • changedOutput schema / properties / request_id / description
      Previous value: -"Order request id; get_order_request_status(request_id) follows it"New value: +"Order request id; get_order_status(request_id) follows it"
    • changedOutput schema / properties / status / description
      Previous value: -"pending_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)"New value: +"pending_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_status)"
    • changedOutput schema / properties / take_profits / description
      Previous value: -"set_take_profit_levels: the take-profits now on the exchange"New value: +"set_take_profits: the take-profits now on the exchange"
  3. Changed119 schema fields changed
    • removedInput schema / properties / client_order_id / title
      Removed value: -"Client Order Id"
    • removedInput schema / properties / preview_id / title
      Removed value: -"Preview Id"
    • removedInput schema / properties / wait_seconds / title
      Removed value: -"Wait Seconds"
    • removedInput schema / title
      Removed value: -"execute_previewed_orderArguments"
    • removedOutput schema / $defs / CheckOut / properties / current / anyOf
      Removed value: -[
      -  {
      -    "type": "number"
      -  },
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • removedOutput schema / $defs / CheckOut / properties / current / default
      Removed value: -null
    • removedOutput schema / $defs / CheckOut / properties / current / title
      Removed value: -"Current"
    • addedOutput schema / $defs / CheckOut / properties / current / type
      Added value: +[
      +  "number",
      +  "string",
      +  "null"
      +]
    • addedOutput schema / $defs / CheckOut / properties / deprecation / additionalProperties
      Added value: +true
    • removedOutput schema / $defs / CheckOut / properties / deprecation / anyOf
      Removed value: -[
      -  {
      -    "additionalProperties": true,
      -    "type": "object"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • removedOutput schema / $defs / CheckOut / properties / deprecation / default
      Removed value: -null
    • removedOutput schema / $defs / CheckOut / properties / deprecation / title
      Removed value: -"Deprecation"
    • addedOutput schema / $defs / CheckOut / properties / deprecation / type
      Added value: +[
      +  "object",
      +  "null"
      +]
    • removedOutput schema / $defs / CheckOut / properties / layer / title
      Removed value: -"Layer"
    • removedOutput schema / $defs / CheckOut / properties / limit / anyOf
      Removed value: -[
      -  {
      -    "type": "number"
      -  },
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • removedOutput schema / $defs / CheckOut / properties / limit / default
      Removed value: -null
    • removedOutput schema / $defs / CheckOut / properties / limit / title
      Removed value: -"Limit"
    • addedOutput schema / $defs / CheckOut / properties / limit / type
      Added value: +[
      +  "number",
      +  "string",
      +  "null"
      +]
    • removedOutput schema / $defs / CheckOut / properties / message / title
      Removed value: -"Message"
    • removedOutput schema / $defs / CheckOut / properties / rule / title
      Removed value: -"Rule"
    • removedOutput schema / $defs / CheckOut / properties / status / title
      Removed value: -"Status"
    • removedOutput schema / $defs / CheckOut / title
      Removed value: -"CheckOut"
    • removedOutput schema / $defs / FeeOut / properties / actual / anyOf
      Removed value: -[
      -  {
      -    "type": "number"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • removedOutput schema / $defs / FeeOut / properties / actual / title
      Removed value: -"Actual"
    • addedOutput schema / $defs / FeeOut / properties / actual / type
      Added value: +[
      +  "number",
      +  "null"
      +]
    • removedOutput schema / $defs / FeeOut / properties / actual_usd / anyOf
      Removed value: -[
      -  {
      -    "type": "number"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • removedOutput schema / $defs / FeeOut / properties / actual_usd / title
      Removed value: -"Actual Usd"
    • addedOutput schema / $defs / FeeOut / properties / actual_usd / type
      Added value: +[
      +  "number",
      +  "null"
      +]
    • removedOutput schema / $defs / FeeOut / properties / asset / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • removedOutput schema / $defs / FeeOut / properties / asset / title
      Removed value: -"Asset"
    • addedOutput schema / $defs / FeeOut / properties / asset / type
      Added value: +[
      +  "string",
      +  "null"
      +]
    • addedOutput schema / $defs / FeeOut / properties / deprecation / additionalProperties
      Added value: +true
    • removedOutput schema / $defs / FeeOut / properties / deprecation / anyOf
      Removed value: -[
      -  {
      -    "additionalProperties": true,
      -    "type": "object"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • removedOutput schema / $defs / FeeOut / properties / deprecation / default
      Removed value: -null
    • removedOutput schema / $defs / FeeOut / properties / deprecation / title
      Removed value: -"Deprecation"
    • addedOutput schema / $defs / FeeOut / properties / deprecation / type
      Added value: +[
      +  "object",
      +  "null"
      +]
    • removedOutput schema / $defs / FeeOut / properties / estimated_usd / anyOf
      Removed value: -[
      -  {
      -    "type": "number"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • removedOutput schema / $defs / FeeOut / properties / estimated_usd / title
      Removed value: -"Estimated Usd"
    • addedOutput schema / $defs / FeeOut / properties / estimated_usd / type
      Added value: +[
      +  "number",
      +  "null"
      +]
    • removedOutput schema / $defs / FeeOut / properties / kind / title
      Removed value: -"Kind"
    • removedOutput schema / $defs / FeeOut / properties / status / title
      Removed value: -"Status"
    • removedOutput schema / $defs / FeeOut / title
      Removed value: -"FeeOut"
    • addedOutput schema / $defs / TakeProfitOut / properties / deprecation / additionalProperties
      Added value: +true
    • removedOutput schema / $defs / TakeProfitOut / properties / deprecation / anyOf
      Removed value: -[
      -  {
      -    "additionalProperties": true,
      -    "type": "object"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • removedOutput schema / $defs / TakeProfitOut / properties / deprecation / default
      Removed value: -null
    • removedOutput schema / $defs / TakeProfitOut / properties / deprecation / title
      Removed value: -"Deprecation"
    • addedOutput schema / $defs / TakeProfitOut / properties / deprecation / type
      Added value: +[
      +  "object",
      +  "null"
      +]
    • removedOutput schema / $defs / TakeProfitOut / properties / order_id / title
      Removed value: -"Order Id"
    • removedOutput schema / $defs / TakeProfitOut / properties / price / title
      Removed value: -"Price"
    • removedOutput schema / $defs / TakeProfitOut / properties / size_base / title
      Removed value: -"Size Base"
    • removedOutput schema / $defs / TakeProfitOut / title
      Removed value: -"TakeProfitOut"
    • removedOutput schema / properties / approval_expires_at / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • removedOutput schema / properties / approval_expires_at / default
      Removed value: -null
    • removedOutput schema / properties / approval_expires_at / title
      Removed value: -"Approval Expires At"
    • addedOutput schema / properties / approval_expires_at / type
      Added value: +[
      +  "string",
      +  "null"
      +]
    • removedOutput schema / properties / checks / anyOf
      Removed value: -[
      -  {
      -    "items": {
      -      "$ref": "#/$defs/CheckOut"
      -    },
      -    "type": "array"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • removedOutput schema / properties / checks / default
      Removed value: -null
    • addedOutput schema / properties / checks / items
      Added value: +{
      +  "$ref": "#/$defs/CheckOut"
      +}
    • removedOutput schema / properties / checks / title
      Removed value: -"Checks"
    • addedOutput schema / properties / checks / type
      Added value: +[
      +  "array",
      +  "null"
      +]
    • addedOutput schema / properties / deprecation / additionalProperties
      Added value: +true
    • removedOutput schema / properties / deprecation / anyOf
      Removed value: -[
      -  {
      -    "additionalProperties": true,
      -    "type": "object"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • removedOutput schema / properties / deprecation / default
      Removed value: -null
    • removedOutput schema / properties / deprecation / title
      Removed value: -"Deprecation"
    • addedOutput schema / properties / deprecation / type
      Added value: +[
      +  "object",
      +  "null"
      +]
    • addedOutput schema / properties / error / additionalProperties
      Added value: +true
    • removedOutput schema / properties / error / anyOf
      Removed value: -[
      -  {
      -    "additionalProperties": true,
      -    "type": "object"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • removedOutput schema / properties / error / default
      Removed value: -null
    • removedOutput schema / properties / error / title
      Removed value: -"Error"
    • addedOutput schema / properties / error / type
      Added value: +[
      +  "object",
      +  "null"
      +]
    • removedOutput schema / properties / fee / default
      Removed value: -null
    • removedOutput schema / properties / fill_price / anyOf
      Removed value: -[
      -  {
      -    "type": "number"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • removedOutput schema / properties / fill_price / default
      Removed value: -null
    • removedOutput schema / properties / fill_price / title
      Removed value: -"Fill Price"
    • addedOutput schema / properties / fill_price / type
      Added value: +[
      +  "number",
      +  "null"
      +]
    • removedOutput schema / properties / filled_size / anyOf
      Removed value: -[
      -  {
      -    "type": "number"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • removedOutput schema / properties / filled_size / default
      Removed value: -null
    • removedOutput schema / properties / filled_size / title
      Removed value: -"Filled Size"
    • addedOutput schema / properties / filled_size / type
      Added value: +[
      +  "number",
      +  "null"
      +]
    • removedOutput schema / properties / legs / anyOf
      Removed value: -[
      -  {
      -    "items": {
      -      "additionalProperties": true,
      -      "type": "object"
      -    },
      -    "type": "array"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • removedOutput schema / properties / legs / default
      Removed value: -null
    • addedOutput schema / properties / legs / items
      Added value: +{
      +  "additionalProperties": true,
      +  "type": "object"
      +}
    • removedOutput schema / properties / legs / title
      Removed value: -"Legs"
    • addedOutput schema / properties / legs / type
      Added value: +[
      +  "array",
      +  "null"
      +]
    • removedOutput schema / properties / ok / title
      Removed value: -"Ok"
    • removedOutput schema / properties / order_id / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • removedOutput schema / properties / order_id / default
      Removed value: -null
    • removedOutput schema / properties / order_id / title
      Removed value: -"Order Id"
    • addedOutput schema / properties / order_id / type
      Added value: +[
      +  "string",
      +  "null"
      +]
    • removedOutput schema / properties / receipt / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • removedOutput schema / properties / receipt / default
      Removed value: -null
    • removedOutput schema / properties / receipt / title
      Removed value: -"Receipt"
    • addedOutput schema / properties / receipt / type
      Added value: +[
      +  "string",
      +  "null"
      +]
    • removedOutput schema / properties / request_id / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • removedOutput schema / properties / request_id / title
      Removed value: -"Request Id"
    • addedOutput schema / properties / request_id / type
      Added value: +[
      +  "string",
      +  "null"
      +]
    • removedOutput schema / properties / sl_oid / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • removedOutput schema / properties / sl_oid / default
      Removed value: -null
    • removedOutput schema / properties / sl_oid / title
      Removed value: -"Sl Oid"
    • addedOutput schema / properties / sl_oid / type
      Added value: +[
      +  "string",
      +  "null"
      +]
    • removedOutput schema / properties / status / title
      Removed value: -"Status"
    • removedOutput schema / properties / take_profits / anyOf
      Removed value: -[
      -  {
      -    "items": {
      -      "$ref": "#/$defs/TakeProfitOut"
      -    },
      -    "type": "array"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • removedOutput schema / properties / take_profits / default
      Removed value: -null
    • addedOutput schema / properties / take_profits / items
      Added value: +{
      +  "$ref": "#/$defs/TakeProfitOut"
      +}
    • removedOutput schema / properties / take_profits / title
      Removed value: -"Take Profits"
    • addedOutput schema / properties / take_profits / type
      Added value: +[
      +  "array",
      +  "null"
      +]
    • removedOutput schema / properties / trigger_expires_at / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • removedOutput schema / properties / trigger_expires_at / default
      Removed value: -null
    • removedOutput schema / properties / trigger_expires_at / title
      Removed value: -"Trigger Expires At"
    • addedOutput schema / properties / trigger_expires_at / type
      Added value: +[
      +  "string",
      +  "null"
      +]
    • removedOutput schema / properties / trigger_price / anyOf
      Removed value: -[
      -  {
      -    "type": "number"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • removedOutput schema / properties / trigger_price / default
      Removed value: -null
    • removedOutput schema / properties / trigger_price / title
      Removed value: -"Trigger Price"
    • addedOutput schema / properties / trigger_price / type
      Added value: +[
      +  "number",
      +  "null"
      +]
    • removedOutput schema / properties / venue / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • removedOutput schema / properties / venue / default
      Removed value: -null
    • removedOutput schema / properties / venue / title
      Removed value: -"Venue"
    • addedOutput schema / properties / venue / type
      Added value: +[
      +  "string",
      +  "null"
      +]
    • removedOutput schema / title
      Removed value: -"RequestOut"
  4. 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"
      +}
  5. 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"
      +}
  6. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Goes well beyond the annotations: it discloses the re-pricing step, that the stop-loss is placed at the exchange, that execution may block awaiting human approval (propose level or missing trade:execute scope), and how wait_seconds governs that wait. It also spells out the irreversible consequence ('a fill cannot be undone') and names the recovery path (close_position), which annotations alone never 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?

Information-dense and front-loaded, starting with the core action before preconditions, risks, and next steps. The telegraphic, clause-stacked style (colons, parentheticals, fragments) is efficient but demands careful parsing, keeping it just short of 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?

Given an output schema exists and needn't be explained, the description covers everything an agent needs for a destructive, open-world, approval-gated execution: prerequisites, idempotency, blocking behavior, irreversibility, recovery, and follow-up. Nothing material is missing for correct invocation.

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 preview_id, client_order_id, and wait_seconds are already documented in the schema. The description mostly restates those semantics (idempotency key behavior, wait window) and adds only mild context about the approval-wait condition; baseline 3 is appropriate when the schema carries the parameter burden.

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 ('Execute a preview from preview_order') and immediately distinguishes the operation from its predecessor by describing what happens: fresh price re-check, send to exchange, stop-loss placed there. An agent can tell this apart from preview_order and amend_entry_order without opening any 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?

Explicit preconditions ('Use only after a successful preview'), explicit exclusions with the alternative ('Not for new or changed orders (preview again)'), and a next-step routing rule ('Next: get_order_status(request_id) while pending'). Nothing about when to call or not call is left 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.

Resources