MT-MCP Docs
Tool Reference

Position Action

4 tools — auto-generated from the MCP server's tool schemas.

Generated

This page is generated from packages/server/mcp/src/tools/*.ts by pnpm docs:generate-tools. Do not edit it by hand — edit the tool's description/schema in source and regenerate.

close_all_positions

Closes all currently open positions, optionally filtered by symbol. The EA executes all closes in a single command to avoid N round-trips and partial-disconnect risk. Returns a results array with per-ticket success/failure. Defaults to dry_run=true — set dry_run=false to execute live. Requires the trade capability and inp_AllowTrading=true on the EA.

This tool can affect a live trading account. dry_run defaults to true — pass dry_run: false explicitly to execute for real.

Parameters

NameTypeRequiredDefaultDescription
symbolstringNo
dry_runbooleanNotrue
terminal_idstringNo

reverse_position

Closes an open position and opens a market order in the opposite direction as ONE EA command (single trade-context acquisition — minimises the gap between the two fills vs separate close_position + place_order calls). volume defaults to the closed volume; optional stop_loss / take_profit apply to the new position. If the close succeeds but the open fails (margin, market closed), returns REVERSE_PARTIAL with the close details and leaves the account flat — the EA never retries the open on its own. Defaults to dry_run=true — set dry_run=false to execute live. Requires the trade capability and inp_AllowTrading=true on the EA.

This tool can affect a live trading account. dry_run defaults to true — pass dry_run: false explicitly to execute for real.

Parameters

NameTypeRequiredDefaultDescription
ticketintegerYes
volumenumberNo
stop_lossnumberNo
take_profitnumberNo
dry_runbooleanNotrue
terminal_idstringNo

set_breakeven

Moves the stop loss of a position (or all positions) to its entry price. Optional buffer_points adds N points on the safe side of entry. Returns POSITION_NOT_IN_PROFIT if the position has not yet moved favourably. Defaults to dry_run=true — set dry_run=false to execute live. Requires the trade capability and inp_AllowTrading=true on the EA.

This tool can affect a live trading account. dry_run defaults to true — pass dry_run: false explicitly to execute for real.

Parameters

NameTypeRequiredDefaultDescription
ticketintegerNo
buffer_pointsintegerNo0
dry_runbooleanNotrue
terminal_idstringNo

set_trailing_stop

Registers a software trailing stop on a position. The EA updates the SL each timer cycle when price moves trailing_points in the position's favour. IMPORTANT: trailing state is lost if the EA restarts — callers should re-set after reconnect. trailing_points minimum is 10. Defaults to dry_run=true — set dry_run=false to register live. Requires the trade capability and inp_AllowTrading=true on the EA.

This tool can affect a live trading account. dry_run defaults to true — pass dry_run: false explicitly to execute for real.

Parameters

NameTypeRequiredDefaultDescription
ticketintegerYes
trailing_pointsintegerYes
dry_runbooleanNotrue
terminal_idstringNo

On this page