Skip to main content
Glama

set_perp_tpsl

Destructive

Set, amend or cancel a take profit / stop loss on an ALREADY-OPEN perp position (non-custodial).

place_perp_order can attach TP/SL only inline on the order that OPENS a position; this adds one to a position that is already open. Currently supported on Jupiter Perps (position_id = the position pubkey, as returned by perp_positions_all); other venues are refused.

At least one of take_profit_price / stop_loss_price is required. size_pct in (0, 100] is how much of the position the trigger closes. Both are passed through exactly as given -- Crank never chooses or adjusts a trigger price or size. Returns an UNSIGNED transaction to sign; Crank never signs.

jurisdiction: geo-gated like every perps write, including the AU block -- see place_perp_order.

idempotency_key (optional): see cancel_perp_order -- reuse the same key across the build call and its signed_transaction completion call.

signed_transaction / verify (two-phase execution): see place_perp_order. A TP/SL moves no position when set, so confirming the signature landed IS the verification.

venue_action (optional, completion leg only): pass back the build leg's extra['venue_action'] (Jupiter's create-tpsl / update-tpsl, or None when the caller can broadcast itself) so the signed bytes are relayed through the venue's own execute endpoint when the build needs it.

AMEND / CANCEL a resting trigger: read its request_id off perp_positions_all (positions[].tpsl_triggers[].request_id), then call this tool with request_id and either trigger_price (amend -- moves the trigger to that price) or cancel=True (cancel it). position_id and take_profit_price/stop_loss_price are not used in those modes, and mixing them with request_id is refused. Same gates (including the AU block), same two-phase flow -- pass the same request_id / cancel on the completion call.

Permission mode: an on-chain ACTION, not a configuration write -- it is ladder-gated like every value-bearing tool, so observe denies it (PERMISSION_MODE_BLOCKED) and propose defers it.

simulate (optional): true = rehearse this call. The full gate stack (capability, kill switch, session signer, wallet policy, permission mode, soft launch, venue / compliance / token checks, fee quote) is evaluated read-only and returned as verdicts + would_execute, with a paper fill where one applies. Nothing is built, signed, broadcast or charged. Omitted = your wallet's default_simulate setting; false = execute.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ipNo
venueNo
cancelNo
verifyNo
simulateNo
size_pctNo
caller_idNo
request_idNo
position_idNo
jurisdictionNo
venue_actionNo
trigger_priceNo
wallet_addressYes
idempotency_keyNo
stop_loss_priceNo
take_profit_priceNo
acknowledge_tier_bNo
signed_transactionNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / properties / simulate
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "boolean"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null
      +}
  2. Changed5 schema fields changed
    • addedInput schema / properties / cancel
      Added value: +{
      +  "default": false,
      +  "type": "boolean"
      +}
    • addedInput schema / properties / position_id / default
      Added value: +""
    • addedInput schema / properties / request_id
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null
      +}
    • addedInput schema / properties / trigger_price
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "number"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null
      +}
    • changedInput schema / required
      Previous value: -[
      -  "wallet_address",
      -  "position_id"
      -]New value: +[
      +  "wallet_address"
      +]
  3. Added

TDQS

Score is being calculated.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources