Skip to main content
Glama

fxapis — MetaTrader 5

Close a multi-account order's positions

close_multi_account_order
DestructiveIdempotent

Closes, on the user's real broker accounts (or demo), the positions a settled multi-account order opened, every account at once, and reports each account: closed, not_found, rejected, unresolved or skipped. Confirm it with the user first; reuse an idempotency_key only to retry the same close. Example: {"multi_account_order_id": "", "idempotency_key": ""}

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": {
      "multi_account_order_id": "<multi_account_order_id>",
      "idempotency_key": "<idempotency_key>"
    },
    "name": "close_multi_account_order"
  }
}

Input Schema

NameRequiredDescriptionDefault
account_idsNoOptional: close only these accounts of the order. Omit to close every account's position.
idempotency_keyYesA unique string you generate for THIS action, e.g. a fresh UUID. If a call fails or times out and you retry the same action, send the SAME key: fxapis then returns the first result instead of acting twice. Use a new key only for a genuinely new action.
multi_account_order_idYesThe multi-account order id.

Output Schema

NameRequiredDescriptionDefault
closeYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.1/5.0
Behavior4/5

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

Annotations already declare destructive=true, idempotent=true, openWorld=true and readOnlyHint=false, so the safety profile is covered; the description still adds value by noting the action hits the user's real broker accounts (or demo) and returns a per-account status breakdown. The user-confirmation requirement and idempotency retry semantics are behavior beyond structured fields.

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-loaded with the action and scope, then operational rules, then a compact example; every element earns its place. The first sentence is long and comma-chained, but the status enumeration it carries is useful information rather than padding.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Covers the destructive-action preconditions, idempotency contract and scope, and an output schema exists so return details need not be spelled out. For a destructive, open-world tool, coverage is nearly complete, missing only explicit exclusion of the cancel/close siblings.

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

Parameters3/5

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

Schema description coverage is 100%, so all three parameters are already documented, including the account_ids scoping and the idempotency_key retry contract. The description only supplies a sample payload and reinforces the key-reuse rule, adding little beyond the schema baseline.

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 and resource (closes the positions a settled multi-account order opened), the scope (every account at once), and the outcome surface (per-account closed/not_found/rejected/unresolved/skipped). This clearly distinguishes it from the single-position close_position sibling without naming it.

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 a real precondition (order must be settled) and an explicit process rule (confirm with the user first; reuse an idempotency_key only to retry the same close). It does not explicitly contrast with cancel_multi_account_order or close_position, so there is no full when-not guidance, but the context is unambiguous.

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