Skip to main content
Glama
Public.com MCP Server

Public.com MCP Server

Official
by PublicDotCom

cancel_and_replace_order

Destructive

Atomically cancel an existing equity, option, or crypto order and replace it with new parameters in one action, avoiding separate cancel and re-submit steps.

Instructions

Atomically cancel an existing order and replace it with new parameters.

⚠️ This modifies an existing order.

Supported for equity, option, and crypto quantity orders.

Args: order_id: UUID of the existing order to cancel and replace. order_type: MARKET, LIMIT, STOP, STOP_LIMIT, MARKET_ON_CLOSE or LIMIT_ON_CLOSE for the replacement. time_in_force: DAY or GTD. Default is DAY. quantity: New quantity for the replacement order. Mutually exclusive with amount. amount: New notional dollar amount for the replacement order. Mutually exclusive with quantity. limit_price: New limit price. Required for LIMIT, STOP_LIMIT and LIMIT_ON_CLOSE replacements. stop_price: New stop price (for STOP/STOP_LIMIT orders). expiration_time: Required when time_in_force is GTD. ISO 8601 format. account_id: Account ID. Optional if PUBLIC_COM_ACCOUNT_ID is set.

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": {
      "order_id": "<order_id>",
      "order_type": "<order_type>"
    },
    "name": "cancel_and_replace_order"
  }
}

Input Schema

NameRequiredDescriptionDefault
amountNo
order_idYes
quantityNo
account_idNo
order_typeYes
stop_priceNo
limit_priceNo
time_in_forceNoDAY
expiration_timeNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.6.1
    • addedInput schema / properties / amount
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "title": "Amount"
      +}
  2. First observedv0.3.1

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already declare destructiveHint=true, readOnlyHint=false, openWorldHint=true, and idempotentHint=false. The description adds meaningful context beyond annotations: the operation is atomic, modifies an existing order, and is limited to specific asset types. It does not describe failure behavior or permission requirements, but the annotation coverage lowers the burden.

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 front-loaded with the atomic cancel-and-replace purpose and a warning that it modifies an existing order. The Args section is structured and each entry earns its place by clarifying a parameter. There is no wasted text.

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 tool has an output schema, so return values need not be explained. For a nine-parameter destructive mutation, the description covers purpose, mutation warning, supported asset types, and detailed parameter semantics. Nothing essential for correct invocation is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description carries the full burden of explaining parameters. It documents all nine parameters, including allowed order_type values, time_in_force default, mutual exclusivity of quantity and amount, conditional requirements for limit_price and expiration_time, and the optional account_id fallback. This is a strong compensation for the schema gap.

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 verb and resource: atomically cancel an existing order and replace it with new parameters. This distinguishes it from the sibling cancel_order and place_order tools by making the combined atomic replacement explicit. An agent can identify the operation without opening the schema.

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?

The description provides clear usage context: it modifies an existing order and is supported for equity, option, and crypto quantity orders. It does not explicitly name alternatives such as using cancel_order followed by place_order, nor does it state when not to use this tool. The context is clear but exclusions and alternatives are absent.

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