Skip to main content
Glama
CoinRithm

CoinRithm/coinrithm-agent-trading

Official

Set futures stop-loss / take-profit

set_futures_sl_tp
Idempotent

Set or clear stop-loss and take-profit triggers on an open mock futures position, with side-aware validation and automatic full-position close at mark when triggered.

Instructions

Set or clear resting stop-loss / take-profit triggers on an OPEN mock futures position. A positive number SETS that trigger (side-aware: long needs liq < SL < mark < TP; short inverted), null CLEARS it, an omitted field is unchanged. Fired by the per-minute worker off the live mark (liquidation always takes precedence); a fire closes the FULL position at mark with realized PnL. Discover fills between polls via my_trades with updatedSince. Requires the trade:futures scope. Paper trading only (virtual mUSD). Fills follow paper_execution_v1 with a disclosed execution cost; see executionModel in quote/trade results.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
agentTraceNoOptional private trace metadata stored in the caller's ledger.
positionIdYesOpen futures position id.
stopLossPriceNoPositive number sets; null clears; omit = unchanged.
takeProfitPriceNoPositive number sets; null clears; omit = unchanged.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
okYes
bodyNo
httpStatusYes
ledgerStatusNo
ledgerEventIdNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changedv0.1.23
    • removedOutput schema / properties / body / description
      Removed value: -"Parsed CoinRithm response body, or raw text when the response is not JSON."
    • removedOutput schema / properties / httpStatus / description
      Removed value: -"HTTP status returned by CoinRithm, or 0 for network errors."
    • removedOutput schema / properties / ledgerEventId / description
      Removed value: -"Private AgentActionEvent id returned by /api/agent/*, when present."
    • removedOutput schema / properties / ledgerStatus / description
      Removed value: -"Ledger write status header returned by CoinRithm, when present."
    • removedOutput schema / properties / ok / description
      Removed value: -"True when CoinRithm returned a successful 2xx response."
  2. Changed3 schema fields changedv0.1.8
    • addedInput schema / properties / agentTrace
      Added value: +{
      +  "additionalProperties": false,
      +  "description": "Optional private trace metadata stored in the caller's ledger.",
      +  "properties": {
      +    "confidence": {
      +      "description": "Optional confidence score from 0 to 1.",
      +      "maximum": 1,
      +      "minimum": 0,
      +      "type": "number"
      +    },
      +    "decisionId": {
      +      "description": "Agent decision id for quote/write attribution.",
      +      "minLength": 1,
      +      "type": "string"
      +    },
      +    "rationaleSummary": {
      +      "description": "Optional concise rationale summary. Do not include chain-of-thought, secrets, or account identity.",
      +      "maxLength": 1200,
      +      "minLength": 1,
      +      "type": "string"
      +    },
      +    "runId": {
      +      "description": "Agent run id for grouping.",
      +      "minLength": 1,
      +      "type": "string"
      +    },
      +    "strategyLabel": {
      +      "description": "Short strategy label, self-reported by the caller.",
      +      "maxLength": 120,
      +      "minLength": 1,
      +      "type": "string"
      +    }
      +  },
      +  "type": "object"
      +}
    • addedOutput schema / properties / ledgerEventId
      Added value: +{
      +  "description": "Private AgentActionEvent id returned by /api/agent/*, when present.",
      +  "type": [
      +    "string",
      +    "null"
      +  ]
      +}
    • addedOutput schema / properties / ledgerStatus
      Added value: +{
      +  "description": "Ledger write status header returned by CoinRithm, when present.",
      +  "type": [
      +    "string",
      +    "null"
      +  ]
      +}
  3. Addedv0.1.5

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 (readOnly=false, idempotent=true, destructive=false) by disclosing that a per-minute worker fires off the live mark, that liquidation takes precedence, that a fire closes the FULL position at mark with realized PnL, that fills between polls surface via my_trades with updatedSince, and that execution follows paper_execution_v1 with a disclosed cost. This is unusually rich operational context.

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?

Dense but front-loaded: the core action and trigger semantics come first, then firing behavior, then scope/paper-mode caveats. Some clauses (agentTrace is not mentioned at all, executionModel pointer) could be trimmed, but each sentence carries real information.

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?

With an output schema present, return values need no explanation, and the description covers the remaining gaps an agent needs: side-aware constraints, firing mechanics, scope, paper-trading status, and the execution-cost model.

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 the baseline is 3, and the schema already states 'positive sets; null clears; omit = unchanged'. The description adds genuine value beyond that with the side-aware ordering constraint (long: liq < SL < mark < TP; short inverted), which the schema does not encode.

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 pair ('Set or clear') and precise resource ('resting stop-loss / take-profit triggers on an OPEN mock futures position'), which cleanly distinguishes it from open_futures_position and close_futures_position among siblings.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives the precondition (position must be OPEN), the semantics of set/clear/omit, and the scope requirement (trade:futures), so the agent knows the context. It does not explicitly name alternative tools for adjacent needs (e.g. close_futures_position for full exits), which keeps it short of a 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.