Skip to main content
Glama

prepare_perp_order

Prepare an unsigned perpetual order for one reviewed venue, without signing or submitting it. Venue decides the artifact shape: hyperliquid returns an unsigned exchange order envelope (HyperCore); synthetix-perps-v3-base returns EVM calldata for commitOrder whose acceptablePrice is derived from Insight cross-oracle consensus, not the Synthetix mark price; aster-perps-bnb-mainnet returns a canonical centralized REST order payload (not calldata, and it proves payload binding rather than on-chain execution); solana_drift returns a Borsh instruction payload that the caller must complete with the Drift SDK. The reviewed guard runs inside each adapter, so the result carries the risk verdict reference. Use it when an agent has decided on venue, market, side and size. Do not use it to create a nonce, sign, or submit an order. Returns the shared prepared-execution envelope: state (READY, CAUTION, REQUIRES_COMPLETION, BLOCK or UNAVAILABLE), a payload whose kind is evm-transaction, venue-rest-order, solana-instruction or null, a required validity_anchor (timestamp, EVM block, Solana block height or venue policy), caller requirements and the guard verdict reference. It never returns a uniformly described executable trade package, and a payload that still needs caller completion is never labelled READY. A venue-rest-order payload exposes execution_binding with proves_onchain_execution: false and the signing requirement. Solana message payloads carry transactionHash (sha256 of the exact unsigned bytes, byte binding only, not signature-verifiable) and messageHash (null when the message segment cannot be derived). Deprecated alias: prefer trade_guard with op "prepare_perp_order". Removed on 2027-01-06.

Input Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed15 schema fields changed
    • addedInput schema / oneOf
      Added value: +[
      +  {
      +    "properties": {
      +      "builder_fee": {
      +        "additionalProperties": {},
      +        "propertyNames": {
      +          "type": "string"
      +        },
      +        "type": "object"
      +      },
      +      "client_order_id": {
      +        "pattern": "^0x[0-9a-fA-F]{32}$",
      +        "type": "string"
      +      },
      +      "expires_after_seconds": {
      +        "maximum": 120,
      +        "minimum": 5,
      +        "type": "integer"
      +      },
      +      "limit_price": {
      +        "description": "Exact IOC limit price decimal string",
      +        "minLength": 1,
      +        "type": "string"
      +      },
      +      "market": {
      +        "enum": [
      +          "BTC",
      +          "ETH",
      +          "HYPE"
      +        ],
      +        "type": "string"
      +      },
      +      "max_mark_oracle_deviation_bps": {
      +        "maximum": 10000,
      +        "minimum": 0,
      +        "type": "number"
      +      },
      +      "max_notional_usd": {
      +        "maximum": 1000000000,
      +        "minimum": 1,
      +        "type": "number"
      +      },
      +      "max_price_impact_bps": {
      +        "maximum": 10000,
      +        "minimum": 0,
      +        "type": "number"
      +      },
      +      "reduce_only": {
      +        "type": "boolean"
      +      },
      +      "require_full_fill": {
      +        "type": "boolean"
      +      },
      +      "side": {
      +        "enum": [
      +          "buy",
      +          "sell"
      +        ],
      +        "type": "string"
      +      },
      +      "size": {
      +        "description": "Exact base size decimal string",
      +        "minLength": 1,
      +        "type": "string"
      +      },
      +      "venue": {
      +        "const": "hyperliquid",
      +        "description": "HyperCore perpetual venue",
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "venue",
      +      "market",
      +      "side",
      +      "size",
      +      "limit_price",
      +      "reduce_only",
      +      "client_order_id",
      +      "max_notional_usd",
      +      "max_price_impact_bps",
      +      "max_mark_oracle_deviation_bps"
      +    ],
      +    "type": "object"
      +  },
      +  {
      +    "properties": {
      +      "account_id": {
      +        "anyOf": [
      +          {
      +            "pattern": "^[1-9][0-9]*$",
      +            "type": "string"
      +          },
      +          {
      +            "exclusiveMinimum": 0,
      +            "maximum": 9007199254740991,
      +            "type": "integer"
      +          }
      +        ]
      +      },
      +      "account_owner": {
      +        "pattern": "^0x[0-9a-fA-F]{40}$",
      +        "type": "string"
      +      },
      +      "leverage": {
      +        "exclusiveMinimum": 0,
      +        "maximum": 100,
      +        "type": "number"
      +      },
      +      "limit_price": {
      +        "minLength": 1,
      +        "type": "string"
      +      },
      +      "market": {
      +        "enum": [
      +          "BTC",
      +          "ETH",
      +          "SOL",
      +          "XRP",
      +          "DOGE",
      +          "PEPE"
      +        ],
      +        "type": "string"
      +      },
      +      "max_slippage_bps": {
      +        "maximum": 10000,
      +        "minimum": 0,
      +        "type": "integer"
      +      },
      +      "order_type": {
      +        "enum": [
      +          "market",
      +          "limit"
      +        ],
      +        "type": "string"
      +      },
      +      "quantity": {
      +        "description": "Exact base-asset quantity decimal string",
      +        "minLength": 1,
      +        "type": "string"
      +      },
      +      "settlement_strategy_id": {
      +        "const": 0,
      +        "type": "number"
      +      },
      +      "side": {
      +        "description": "buy maps to open_long, sell to open_short",
      +        "enum": [
      +          "buy",
      +          "sell"
      +        ],
      +        "type": "string"
      +      },
      +      "valid_for_seconds": {
      +        "maximum": 120,
      +        "minimum": 5,
      +        "type": "integer"
      +      },
      +      "venue": {
      +        "const": "synthetix-perps-v3-base",
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "venue",
      +      "market",
      +      "side",
      +      "quantity",
      +      "leverage",
      +      "max_slippage_bps",
      +      "account_id",
      +      "account_owner"
      +    ],
      +    "type": "object"
      +  },
      +  {
      +    "properties": {
      +      "client_order_id": {
      +        "pattern": "^[A-Za-z0-9_-]{1,36}$",
      +        "type": "string"
      +      },
      +      "leverage": {
      +        "exclusiveMinimum": 0,
      +        "maximum": 100,
      +        "type": "number"
      +      },
      +      "limit_price": {
      +        "minLength": 1,
      +        "type": "string"
      +      },
      +      "market": {
      +        "enum": [
      +          "BTC",
      +          "ETH"
      +        ],
      +        "type": "string"
      +      },
      +      "max_slippage_bps": {
      +        "maximum": 10000,
      +        "minimum": 0,
      +        "type": "integer"
      +      },
      +      "order_type": {
      +        "enum": [
      +          "market",
      +          "limit"
      +        ],
      +        "type": "string"
      +      },
      +      "quantity": {
      +        "description": "Exact base-asset quantity decimal string",
      +        "minLength": 1,
      +        "type": "string"
      +      },
      +      "side": {
      +        "description": "buy maps to open_long, sell to open_short",
      +        "enum": [
      +          "buy",
      +          "sell"
      +        ],
      +        "type": "string"
      +      },
      +      "valid_for_seconds": {
      +        "maximum": 120,
      +        "minimum": 5,
      +        "type": "integer"
      +      },
      +      "venue": {
      +        "const": "aster-perps-bnb-mainnet",
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "venue",
      +      "market",
      +      "side",
      +      "quantity",
      +      "leverage",
      +      "max_slippage_bps",
      +      "client_order_id"
      +    ],
      +    "type": "object"
      +  },
      +  {
      +    "properties": {
      +      "expires_after_seconds": {
      +        "maximum": 300,
      +        "minimum": 1,
      +        "type": "integer"
      +      },
      +      "margin_value_usd": {
      +        "exclusiveMinimum": 0,
      +        "type": "number"
      +      },
      +      "market": {
      +        "enum": [
      +          "SOL",
      +          "BTC",
      +          "ETH"
      +        ],
      +        "type": "string"
      +      },
      +      "side": {
      +        "description": "buy maps to open_long, sell to open_short",
      +        "enum": [
      +          "buy",
      +          "sell"
      +        ],
      +        "type": "string"
      +      },
      +      "size_base": {
      +        "minLength": 1,
      +        "type": "string"
      +      },
      +      "size_usd": {
      +        "exclusiveMinimum": 0,
      +        "type": "number"
      +      },
      +      "user_index": {
      +        "maximum": 65535,
      +        "minimum": 0,
      +        "type": "integer"
      +      },
      +      "venue": {
      +        "const": "solana_drift",
      +        "type": "string"
      +      },
      +      "wallet": {
      +        "description": "Drift order authority / fee payer",
      +        "pattern": "^[1-9A-HJ-NP-Za-km-z]{32,44}$",
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "venue",
      +      "market",
      +      "side",
      +      "size_usd",
      +      "margin_value_usd",
      +      "wallet"
      +    ],
      +    "type": "object"
      +  }
      +]
    • removedInput schema / properties / builder_fee
      Removed value: -{
      -  "additionalProperties": {},
      -  "propertyNames": {
      -    "type": "string"
      -  },
      -  "type": "object"
      -}
    • removedInput schema / properties / client_order_id
      Removed value: -{
      -  "pattern": "^0x[0-9a-fA-F]{32}$",
      -  "type": "string"
      -}
    • removedInput schema / properties / expires_after_seconds
      Removed value: -{
      -  "maximum": 120,
      -  "minimum": 5,
      -  "type": "integer"
      -}
    • removedInput schema / properties / limit_price
      Removed value: -{
      -  "description": "Exact IOC limit price decimal string",
      -  "minLength": 1,
      -  "type": "string"
      -}
    • removedInput schema / properties / market
      Removed value: -{
      -  "enum": [
      -    "BTC",
      -    "ETH",
      -    "HYPE"
      -  ],
      -  "type": "string"
      -}
    • removedInput schema / properties / max_mark_oracle_deviation_bps
      Removed value: -{
      -  "maximum": 10000,
      -  "minimum": 0,
      -  "type": "number"
      -}
    • removedInput schema / properties / max_notional_usd
      Removed value: -{
      -  "maximum": 1000000000,
      -  "minimum": 1,
      -  "type": "number"
      -}
    • removedInput schema / properties / max_price_impact_bps
      Removed value: -{
      -  "maximum": 10000,
      -  "minimum": 0,
      -  "type": "number"
      -}
    • removedInput schema / properties / reduce_only
      Removed value: -{
      -  "type": "boolean"
      -}
    • removedInput schema / properties / require_full_fill
      Removed value: -{
      -  "type": "boolean"
      -}
    • removedInput schema / properties / side
      Removed value: -{
      -  "enum": [
      -    "buy",
      -    "sell"
      -  ],
      -  "type": "string"
      -}
    • removedInput schema / properties / size
      Removed value: -{
      -  "description": "Exact base size decimal string",
      -  "minLength": 1,
      -  "type": "string"
      -}
    • removedInput schema / properties / venue
      Removed value: -{
      -  "const": "hyperliquid",
      -  "description": "Only reviewed perp venue",
      -  "type": "string"
      -}
    • removedInput schema / required
      Removed value: -[
      -  "venue",
      -  "market",
      -  "side",
      -  "size",
      -  "limit_price",
      -  "reduce_only",
      -  "client_order_id",
      -  "max_notional_usd",
      -  "max_price_impact_bps",
      -  "max_mark_oracle_deviation_bps"
      -]
  2. Added

TDQS

A4.8/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does: it discloses the state enum (READY, CAUTION, REQUIRES_COMPLETION, BLOCK, UNAVAILABLE), that unprepared payloads are never labelled READY, that a venue-rest-order sets proves_onchain_execution: false, the signing requirement, and the limits of transactionHash/messageHash binding. It also reveals that a guard verdict is embedded per adapter, which is exactly the kind of non-obvious behavior an agent cannot infer.

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?

The core contract is front-loaded in the first sentence and every substantive sentence adds a fact an agent needs (per-venue artifact, guard reference, envelope shape, deprecation). It is still a dense single block of long parenthetical clauses, and the defensive line about never returning "a uniformly described executable trade package" could be tightened.

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?

This is a complex four-variant, venue-polymorphic tool with no output schema, and the description still specifies the return envelope, payload kinds, the required validity_anchor, caller requirements and the guard reference. Nothing critical for calling or interpreting the result is 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 description coverage is 100%, so the baseline is 3; the description earns one more by adding meaning the schema does not encode, notably that Synthetix acceptablePrice comes from Insight cross-oracle consensus rather than the mark price, and that the Solana Borsh payload must be completed with the Drift SDK. It does not walk through individual parameter names, which leaves it short of a 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?

"Prepare an unsigned perpetual order for one reviewed venue, without signing or submitting it" names a specific verb (prepare), resource (perpetual order) and explicit boundary (unsigned, not submitted). It then enumerates the four venues and what each returns, which lets an agent distinguish this from siblings like issue_execution_receipt or check_trade_safety without reading 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?

"Use it when an agent has decided on venue, market, side and size" gives the precondition, and "Do not use it to create a nonce, sign, or submit an order" gives the exclusions. It also routes to the replacement explicitly (trade_guard with op "prepare_perp_order") and dates the removal, so an agent knows both the trigger and the deprecation path.

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.