Skip to main content
Glama

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
MT5_LOGINYesYour MetaTrader 5 login ID
MT5_SERVERYesYour broker's server name
MT5_PASSWORDYesYour MetaTrader 5 password

Capabilities

Features and capabilities supported by this server

CapabilityDetails
tools
{
  "listChanged": false
}
prompts
{
  "listChanged": false
}
resources
{
  "subscribe": false,
  "listChanged": false
}
experimental
{}

Tools

Functions exposed to the LLM to take actions

NameDescription
pingA

Health check - verifies the MT5 terminal is reachable.

Returns {"ok": bool, "latency_ms": int, "via": str | None}. via names the layer that answered (terminal_info, account_info, or tick_probe) and is omitted when ok is false. Cheap; agents should call this after idle periods or errors that smell like disconnection.

get_terminal_infoB

MT5 terminal connection state and broker TZ offset.

get_account_infoC

Balance, equity, margin, leverage, currency, margin mode.

get_quoteA

Current bid/ask for a symbol. Prepares the symbol in Market Watch if needed.

get_symbolsA

List tradeable instruments, optionally filtered by category (e.g. 'Forex', 'Metals').

get_market_hoursA

Whether the given symbol's session is open right now.

v1 limitation: is_open is derived from trade_mode (open when non-zero). next_open and next_close are always None in v1 - parsing symbol_info().sessions_quotes is scheduled for a later release. Agents needing precise session boundaries should consult their broker's published schedule.

get_ratesA

OHLC bars for symbol at timeframe, most recent first.

timeframe: one of M1, M5, M15, M30, H1, H4, D1, W1, MN1. count is clamped to [1, 5000].

calc_marginA

Broker-authoritative margin for a hypothetical order.

Wraps mt5.order_calc_margin. If price is omitted, uses the current ask (buy) / bid (sell). Returned margin is in deposit currency.

get_positionsC

Open positions, optionally filtered to a single symbol.

close_positionB

Close an open position in full or part by ticket.

get_ordersB

Pending orders, optionally filtered to a single symbol.

place_orderA

Place a market or pending order. Optional SL / TP / deviation.

When policy.auto_approve_notional is set > 0, orders whose notional is at or above it return an ApprovalPreview; retry with approval_confirmed=true and the same request fields to proceed. At the default of 0 the gate is off and orders auto-execute. Pass idempotency_key (UUIDv4 recommended) to dedupe retries within idempotency.ttl_seconds.

modify_orderA

Modify SL/TP on a position or price/expiration on a pending order.

When the consent gate is armed (policy.auto_approve_notional > 0), widening or removing an existing SL/TP requires approval; tightening always auto-approves. At the default of 0 the gate is off and every modify auto-executes.

cancel_orderA

Cancel a pending order by ticket. No consent gate (reduces exposure).

get_historyB

Closed deals (trades) within [from_ts, to_ts]. Timestamps must be ISO 8601 UTC.

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription
read_accountCurrent account snapshot (balance, equity, margin, leverage, etc.).
read_positionsCurrently open positions.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/vincentwongso/mt5-trading-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server