Skip to main content
Glama
CoinRithm

CoinRithm/coinrithm-agent-trading

Official

Cancel spot order

cancel_spot_order
DestructiveIdempotent

Cancel a paper spot order's unfilled remainder and free reserved funds using its orderId. Safe to retry; use get_my_trades to confirm fills.

Instructions

Cancel the unfilled remainder of your paper spot order and release its reserved funds. Requires trade:spot scope; get orderId from list_open_orders. Does not reverse filled trades. Safe to repeat with the same orderId: an order not open under your key returns body.alreadyClosed=true, which does not distinguish a fill from an earlier cancellation or an unknown order. Use get_my_trades to check fills. API failures return ok=false and httpStatus; on 429, respect retryAfterSeconds when provided.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
orderIdYesYour paper spot order id from list_open_orders.
agentTraceNoOptional private trace metadata stored in the caller's ledger.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
okYesTrue when CoinRithm returned a successful 2xx response.
bodyNoParsed CoinRithm response body, or raw text when the response is not JSON.
httpStatusYesHTTP status returned by CoinRithm, or 0 for network errors.
ledgerStatusNoLedger write status header returned by CoinRithm, when present.
ledgerEventIdNoPrivate AgentActionEvent id returned by /api/agent/*, when present.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.1.19
    • changedInput schema / properties / orderId / description
      Previous value: -"Open order id."New value: +"Your paper spot order id from list_open_orders."
  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. Changed1 schema field changedv0.1.5
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "http://json-schema.org/draft-07/schema#",
      +  "additionalProperties": false,
      +  "properties": {
      +    "body": {
      +      "description": "Parsed CoinRithm response body, or raw text when the response is not JSON."
      +    },
      +    "httpStatus": {
      +      "description": "HTTP status returned by CoinRithm, or 0 for network errors.",
      +      "type": "integer"
      +    },
      +    "ok": {
      +      "description": "True when CoinRithm returned a successful 2xx response.",
      +      "type": "boolean"
      +    }
      +  },
      +  "required": [
      +    "httpStatus",
      +    "ok"
      +  ],
      +  "type": "object"
      +}
  4. First observedv0.1.4

TDQS

A4.9/5.0
Behavior5/5

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

Beyond the idempotentHint and destructiveHint annotations, the description explains the 'alreadyClosed=true' ambiguity, notes that repeated calls are safe, and details API failure behavior with ok=false, httpStatus, and retryAfterSeconds. This is rich behavioral context beyond structured annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is dense but every sentence earns its place: main operation, auth and source of orderId, idempotency nuance, fill-checking alternative, and rate-limit handling. It is front-loaded with the core action and quickly moves to practical caveats.

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?

The description covers the operation, required scope, orderId source, idempotency ambiguity, fill-check alternative, and error/rate-limit behavior. An output schema exists, so return value details are not required, and the description provides everything else needed to invoke the tool correctly.

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 baseline is 3. The description adds useful meaning for orderId by specifying it must come from list_open_orders and that it is the caller's paper spot order id, reinforcing but not replacing the schema.

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 description states a specific action and resource: 'Cancel the unfilled remainder of your paper spot order and release its reserved funds.' It distinguishes itself from siblings like place_spot_order and get_my_trades by clarifying it only cancels the unfilled remainder, not filled trades.

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 explicitly requires 'trade:spot scope' and tells the agent to get orderId from list_open_orders. It also clarifies when not to rely on this tool by stating 'Does not reverse filled trades' and directs to get_my_trades to check fills, plus gives 429 retry guidance.

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