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.

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": {
      "wallet_address": "<wallet_address>"
    },
    "name": "set_perp_tpsl"
  }
}

Input 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

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

A4.8/5.0
Behavior5/5

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

Annotations declare readOnlyHint=false and destructiveHint=true, and the description goes well beyond: it discloses that it returns an UNSIGNED transaction, that Crank never signs, geo-gating including the AU block, idempotency-key reuse across build/completion, the two-phase signed_transaction/verify flow, the venue_action relay leg, and ladder-gating behavior (observe denies, propose defers). No contradiction with the destructive/idempotent hints.

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 operation is front-loaded in the first sentence, and subsequent paragraphs are topic-scoped rather than rambling. It is nonetheless long and leans on cross-references ('see place_perp_order', 'see cancel_perp_order') that force the agent to read sibling definitions to complete its understanding.

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 an 18-parameter, state-mutating, two-phase tool, the description covers the modes, gating, execution legs, and idempotency contract. An output schema exists, so return-value documentation is appropriately not duplicated, and the one important return fact (unsigned tx) is still called out.

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?

With 0% schema description coverage the description must carry the parameter burden, and it does for most high-risk parameters: position_id is the position pubkey, size_pct must be in (0,100], request_id drives amend/cancel, trigger_price amends, cancel cancels, and take_profit/stop_loss are passed through verbatim. Peripheral parameters (wallet_address, ip, caller_id, acknowledge_tier_b) remain unexplained in both schema and description, so it falls just short of full compensation.

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?

The opening sentence states a precise verb set (set/amend/cancel), the resource (TP/SL on a perp position), and the critical scoping constraint (ALREADY-OPEN position). It explicitly distinguishes itself from the nearest sibling, place_perp_order, by explaining that the latter only attaches TP/SL inline on the opening order.

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?

It gives explicit when-to-use routing (only Jupiter Perps; other venues refused), when-not (position_id/price fields are not used in amend/cancel modes and mixing them with request_id is refused), and exact preconditions for each mode including where to read request_id from perp_positions_all. The permission-mode and simulate paragraphs further tell the agent which execution paths are valid.

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