Skip to main content
Glama

Close Positions

close_positions
Destructive

Close open broker positions on an enabled Connections account (no trading instance required). Supports all asset classes: Equities, US Options, Crypto, Forex/CFDs, and Prediction Markets. Omit symbol to flatten the account (requires confirm_close_all=true when multiple opens). Prefer this over inventing sell quantities. Broker flatten closes broker exposure; algo-tracked Gogi trade engine positions for the same symbol may still need execute_trade with instance_id or delete_instance with confirm_close_positions. When mcp_require_confirm is true, returns pending_confirmation for Activity Confirm.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sideNoOptional; required when multiple sides (long/short or yes/no) exist for the symbol.
symbolNoOptional — omit to close all positions on the account.
quantityNoOptional partial close; omit for full position. Requires symbol.
broker_account_idNoInteger id from list_brokers. Required when more than one enabled account exists.
confirm_close_allNoRequired true when closing more than one position. Show positions_to_close from a prior response first.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
errorNo
messageNo
successNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • changedOutput schema / description
      Previous value: -"Structured Gogi result. Error responses include error and message fields."New value: +"Structured result. Error responses include error and message."
    • addedOutput schema / properties
      Added value: +{
      +  "error": {
      +    "type": "string"
      +  },
      +  "message": {
      +    "type": "string"
      +  },
      +  "success": {
      +    "type": "boolean"
      +  }
      +}
  2. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "additionalProperties": true,
      +  "description": "Structured Gogi result. Error responses include error and message fields.",
      +  "type": "object"
      +}
  3. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already flag destructive=true and non-idempotent, but the description adds substantial context beyond them: the confirm_close_all requirement for multi-position closes, the pending_confirmation/Activity Confirm flow when mcp_require_confirm is true, and the important distinction that broker flatten does not close algo-tracked engine positions.

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 and slightly long, but front-loaded with the core action and scope. Every sentence carries routing or gating information; little is wasted, though it packs a lot into one paragraph.

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 destructive, confirm-gated mutation tool with 5 params, an output schema, and rich annotations, the description covers the confirmation flow, cross-tool pitfalls, and the flatten-vs-partial distinction. Nothing an agent needs to call it correctly is missing.

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. The description goes further by explaining the symbol-omission flatten behavior, the confirm_close_all gating condition, and the side requirement when multiple sides exist, adding usable semantics over the schema text.

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+resource ('Close open broker positions on an enabled Connections account'), scopes it ('no trading instance required'), and enumerates supported asset classes. It distinguishes itself from siblings like execute_trade and delete_instance by naming them explicitly.

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?

Gives explicit when-to-use ('Prefer this over inventing sell quantities'), when-not-to-use ('Omit symbol to flatten'), and routes the agent to execute_trade/delete_instance for algo-tracked positions. Condition for side and confirm_close_all is stated.

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