Skip to main content
Glama
Public.com MCP Server

Public.com MCP Server

Official
by PublicDotCom

flatten_and_go_short

Destructive

Sells off any existing long position, then places a short-sale order. Converts long exposure to short in a two-step workflow.

Instructions

Sell any existing long position in a symbol, then place a short-sale order.

⚠️ Experimental — this is a two-order workflow, not atomic. Market conditions may change between the flatten fill and the short entry. Both orders execute as real trades.

Each order is preflighted just before it is sent. The server preflights the flatten (a MARKET sell of the whole long position) and asks the user to confirm the whole workflow when the client supports it. After the flatten fills, it preflights the short and checks it against the configured limits. If that check fails, the short is not placed and the account is left flat: the response then has status "flattened_not_shorted" and the flatten's order ID. If the user cancels or the first preflight fails, the response has "submitted": false and nothing is sent.

If no long position exists the flatten step is skipped, and the short is preflighted and confirmed like place_short_order.

Args: symbol: Ticker symbol (e.g. "AAPL"). short_quantity: Number of shares to short after flattening. order_type: MARKET, LIMIT, STOP, STOP_LIMIT, MARKET_ON_CLOSE or LIMIT_ON_CLOSE. Default is MARKET. The on-close types execute at the closing auction. time_in_force: DAY or GTD. Default is DAY. limit_price: Required for LIMIT, STOP_LIMIT and LIMIT_ON_CLOSE orders. stop_price: Required for STOP and STOP_LIMIT orders. expiration_time: Required when time_in_force is GTD. ISO 8601 format. equity_market_session: CORE or EXTENDED. flatten_timeout: Seconds to wait for the flatten order to fill (default 60). 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": {
      "symbol": "<symbol>",
      "short_quantity": "<short_quantity>"
    },
    "name": "flatten_and_go_short"
  }
}

Input Schema

NameRequiredDescriptionDefault
symbolYes
account_idNo
order_typeNoMARKET
stop_priceNo
limit_priceNo
time_in_forceNoDAY
short_quantityYes
expiration_timeNo
flatten_timeoutNo
equity_market_sessionNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.3.1

TDQS

A4.7/5.0
Behavior5/5

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

Annotations already flag destructiveHint=true and idempotentHint=false, but the description adds substantial context the annotations cannot express: the workflow is non-atomic, both legs are real trades, market conditions can shift between fill and entry, each order is preflighted separately, and a failed second preflight returns status "flattened_not_shorted" with the account left flat. Cancellation/first-preflight-failure returns "submitted": false. This is exactly the partial-failure disclosure a mutation tool needs.

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?

Front-loads the risk warning and the outcome branches before the arg list, which is the right ordering for a destructive tool. The Args block is long, but with zero schema coverage that verbosity is buying real information; only minor tightening is possible.

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 a 10-parameter, non-atomic, multi-leg trading workflow, the description covers sequencing, confirmation, timeout, failure statuses, and per-argument constraints. Output schema exists, so return-value detail is correctly not duplicated beyond the status strings needed to reason about partial failure.

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 and does: it lists every one of the 10 args, enumerates order_type values with the default, explains that on-close types execute at the closing auction, states conditional requirements for limit_price/stop_price/expiration_time (ISO 8601), gives equity_market_session values, documents flatten_timeout's default of 60, and notes account_id falls back to PUBLIC_COM_ACCOUNT_ID.

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?

Opens with a specific compound verb+resource: "Sell any existing long position in a symbol, then place a short-sale order." That immediately separates it from place_short_order, which is named later as the analogous single-order path. An agent can pick between them without opening either 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?

Gives clear context for when this applies (you hold a long and want to reverse short) and explicit behavior when the precondition is absent (flatten is skipped and the short proceeds "like place_short_order"). It stops short of an explicit "use place_short_order instead when X" routing statement, which keeps it off a 5.

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