Skip to main content
Glama

MetaTrader 5 MCP Bridge

Let an AI agent manage your MetaTrader 5 account over Model Context Protocol - with configurable human approval gate.

PyPI version PyPI downloads Python License: MIT Tests GitHub stars MCP Ruff

⚠️ This software places real trades through your MetaTrader 5 terminal with real orders and irreversible fills. Read DISCLAIMER.md and SECURITY.md before connecting it to a live account. Always test using your demo account first.

Runs locally - in the same process tree as your agent, no cloud, no telemetry. Windows (native) or Linux (via Docker); Python 3.10+.

📖 The story behind this: this project is built step by step in Wiring AI agent into MetaTrader 5, Part 1 of the Trade with AI agent series on the Fintrix engineering blog.

What it is

mt5-mcp lets an AI agent read your MetaTrader 5 account and place trades through it, over the Model Context Protocol.

  • 12 read-only tools: account, quotes, positions, orders, history, OHLC bars, broker-authoritative margin estimates, and native chart screenshots (Windows). No consent gate.

  • 4 mutating tools: place_order, modify_order, cancel_order, close_position, each behind a preflight + human-consent + idempotency + audit layer.

  • 3 subscribable resources: live account://, positions://, and quotes://{symbol} snapshots that push change notifications.

  • 2 ready-to-use Claude Code skills ship in .claude/skills/: mt5-market-data and mt5-trading teach an agent how to read the account and run the consent flow safely.

Full catalogue and the consent flow: docs/tools.md.

Related MCP server: MetaAPI MCP Server

Why mt5-mcp

  • A safety layer, not just an API wrapper. Every mutating call routes through preflight checks -> an opt-in human-consent gate (arm it to require approval) -> idempotency -> an append-only audit log, so you can put a human in the loop on trades and always keep a replayable record of what the agent did.

  • An honest threat model. It treats an LLM wired to place_order as a live attack surface and says so plainly - the MCP is explicitly not the security boundary (see SECURITY.md).

  • Verifiable proof, not a mock-up. The demo above is a real round-trip; the tickets and balance match MetaTrader 5's own History tab.

  • Local-first. No cloud, no telemetry; runs beside your agent. Windows-native or Linux via an all-in-one Docker image (no rpyc version-matching).

Quickstart (Windows, native)

pip install mt5-trading-mcp
  1. Launch MetaTrader 5 and log into your broker. Enable AlgoTrading (toolbar button green).

  2. Verify the terminal is reachable: python -m mt5_mcp doctor: expect [INFO] backend: native and [PASS] lines.

  3. Run it: python -m mt5_mcp serve.

Wire it to OpenClaw in one command (registers the mcp.servers entry):

openclaw mcp set mt5-mcp '{"command":"python","args":["-m","mt5_mcp","serve"]}'

Quickstart (Linux, Docker)

The MT5 terminal + the MCP run headless in an all-in-one image; your agent talks MCP over HTTP. No host Python, no bridge.

cp deploy/.env.example deploy/.env   # add MT5_LOGIN / MT5_PASSWORD / MT5_SERVER
docker compose -f deploy/docker-compose.yml up -d

Log the terminal in once via the KasmVNC web UI at http://127.0.0.1:3001 (File -> Login to Trade Account; persists across restarts), then point your agent at http://127.0.0.1:8765/mcp. Wire it to OpenClaw in one command:

openclaw mcp set mt5-mcp '{"url":"http://127.0.0.1:8765/mcp","transport":"streamable-http"}'

Full walkthrough: docs/installation.md.

Chart screenshots (Windows only)

get_chart_screenshot(symbol, timeframe, annotations?) returns a PNG of the native MT5 chart, optionally annotated, so an LLM can read it visually (candles, support/resistance, patterns). Because the MetaTrader5 Python API cannot capture charts, this uses a small MQL5 Expert Advisor that runs inside a GUI terminal and calls ChartScreenShot().

See Chart annotations for marking up support/resistance lines, trendlines and notes before capture.

Setup (one time):

  1. Install and attach the AgentScreenshot EA - see mql5/README.md.

  2. Optionally set a template so your indicators/drawings appear in the shot: [screenshot] template = "agent.tpl" in your config, or leave it unset for the default chart.

Config knobs ([screenshot] section): width (default 1600), height (default 900), template (default none), timeout_s (default 10).

Not available on the headless Linux/Docker deployment: it needs a GUI terminal. Off Windows the tool returns SCREENSHOT_NOT_SUPPORTED.

For AI agents

If you've been handed this repository to install and run, follow the runbook in docs/agents.md. It covers platform detection, install, verification, registering the server, and the hard safety rules for trades - read it before calling any mutating tool.

Documentation

Guide

What's in it

Installation & setup

Requirements, Windows + Linux/Docker setup, wiring to an agent.

For AI agents

Step-by-step runbook for an agent installing and running the server.

Configuration

config.toml schema, storage paths, hot-reload.

Tools & resources

Read tools, mutating tools + consent flow, subscribable resources.

MCP client setup

Per-client config snippets and Claude Code usage.

Transports & deployment

stdio/HTTP transports and Windows VPS patterns.

Contributing

How to contribute and run the tests.

Changelog

Release history and known limitations.

Safety

mt5-mcp is not the security boundary, the broker's MT5 server enforces the hard limits (margin, max-lot, symbol permissions). Pre-flight checks in the policy engine are UX guardrails to catch agent mistakes early, not security controls.

The human-consent gate is opt-in and off by default: auto_approve_notional defaults to 0, so mutating calls auto-execute (full-open) - intended for trusted or unattended agents. Arm the gate by setting auto_approve_notional > 0: orders/closes whose notional is at or above it then return an ApprovalPreview you must confirm, and modifying a stop to widen or remove it also requires approval. The pre-flight limits (max_*) and symbol allow/deny lists are likewise opt-in (0 / empty = off). Every mutating call is recorded in an append-only audit JSONL log regardless. For vulnerability disclosure, see SECURITY.md.

Architecture

mt5-mcp wraps the MetaTrader 5 Python library behind a FastMCP server. A single MT5Client (src/mt5_mcp/adapter/) owns the terminal connection, broker-timezone inference, and type conversions; everything else sits on top of it. The Pydantic models in src/mt5_mcp/types.py / src/mt5_mcp/config.py are the source of truth for the data and config schemas.

     Agent / MCP client  (Hermes, OpenClaw, Claude Code, Claude Desktop, …)
                               │
                               │   stdio  ·  loopback HTTP
                               ▼
 ┌──────────────────────────────────────────────────────────┐
 │                      FastMCP server                      │
 │                                                          │
 │   tools/        resources/        policy/                │
 │   read +        subscribable      consent · idempotency  │
 │   mutating      account/quotes    · audit (JSONL)        │
 │                                                          │
 │   streaming/  - change-detection poller + dispatcher     │
 │   types.py · config.py - Pydantic schemas: source of     │
 │                          truth for data + config         │
 │                                                          │
 └──────────────────────────────────────────────────────────┘
                               │
                               ▼
 ┌──────────────────────────────────────────────────────────┐
 │                                                          │
 │   adapter/  MT5Client                                    │
 │   one terminal connection · broker-TZ inference ·        │
 │   type conversions · transparent reinit                  │
 │                                                          │
 └──────────────────────────────────────────────────────────┘
                               │
                               ▼
MetaTrader 5 Python library  ->  broker terminal  ->  broker server

The module paths shown (tools/, resources/, policy/, streaming/, adapter/, types.py, config.py) all live under src/mt5_mcp/.

Contributing

Contributions are welcome, see CONTRIBUTING.md for the dev setup, test workflow, and project principles.

License

MIT - see LICENSE.

Available Tools

15 tools
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.

ParametersJSON Schema
NameRequiredDescriptionDefault
symbolYes
sideYes
volumeYes
priceNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
symbolYes
sideYes
volumeYes
priceYes
marginYes
currencyYes

TDQS

A4/5.0
Behavior4/5

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

No annotations are provided, so the description carries full burden. It discloses wrapping mt5.order_calc_margin, default price behavior, and return currency. No contradictions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences, front-loading the purpose and adding essential detail. No extraneous words.

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?

Given the presence of an output schema, the description adequately covers the tool's behavior and return value (deposit currency). Slight gap in explaining margin concept but acceptable.

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?

With 0% schema description coverage, the description adds meaning for the price parameter (default to current ask/bid) but does not elaborate on symbol, side, or volume beyond their names.

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?

The description clearly states the tool calculates margin for a hypothetical order, using a specific verb 'calc' and resource 'margin'. It differentiates from sibling tools like place_order or get_orders by being a calculation tool.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for margin calculation without explicit when-to-use or alternatives. It provides details on price behavior but no guidance on when to use this vs other tools.

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

cancel_orderA

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

ParametersJSON Schema
NameRequiredDescriptionDefault
ticketYes
idempotency_keyNo

TDQS

A3.7/5.0
Behavior3/5

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

With no annotations, the description must disclose behavioral traits. It mentions the action and that no consent gate exists, but does not explain side effects (e.g., order status changes), error handling, or idempotency behavior despite having an idempotency_key parameter.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, front-loaded with key information. No superfluous text. Every sentence adds value.

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

Completeness2/5

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

Given the tool's simplicity (2 parameters, no output schema), the description lacks detail on idempotency key use, return values, and error conditions. Without annotations, it feels incomplete for an agent to confidently invoke.

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

Parameters2/5

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

Schema coverage is 0%, so the description must compensate. It explains the 'ticket' parameter as the order identifier, but does not explain 'idempotency_key' at all. This leaves the agent without full understanding of all parameters.

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?

The description clearly states the action ('Cancel'), the object ('a pending order'), and the identifier ('by ticket'). It distinguishes from sibling tools like 'modify_order' and 'close_position' by specifying the specific operation on a pending order.

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?

The description provides a behavioral note ('No consent gate (reduces exposure)') that implies when to use this tool over alternatives that may require additional consent. However, it does not explicitly state when not to use or list alternative tools.

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

close_positionB

Close an open position in full or part by ticket.

ParametersJSON Schema
NameRequiredDescriptionDefault
ticketYes
volumeNo
idempotency_keyNo
approval_confirmedNo
approval_request_idNo

TDQS

B3.3/5.0
Behavior2/5

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

With no annotations, the description carries full burden. It states the action (close) but omits important behavioral details: side effects on related orders, permissions required, irreversibility, and what 'ticket' refers to. The tool mutates state, but no guidance on consequences.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single, efficient sentence with no wasted words. It directly communicates the core function.

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

Completeness2/5

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

Despite having 5 parameters, no output schema, and no annotations, the description is minimal. It lacks details on idempotency, approval workflow, and return behavior. The description is insufficient for an AI agent to reliably use all parameters.

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

Parameters2/5

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

Schema coverage is 0%, so the description must compensate. It explains 'ticket' and 'volume' (full/part) but provides no meaning for 'idempotency_key', 'approval_confirmed', or 'approval_request_id'. These parameters are critical for correct invocation and remain unexplained.

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?

The description clearly states the verb 'Close' and resource 'open position', with scope 'in full or part by ticket'. It distinguishes from sibling tools like 'cancel_order' and 'get_positions'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage (close a position by ticket) but does not explicitly state when to use this tool versus alternatives like 'cancel_order' or specify prerequisites such as obtaining a ticket from 'get_positions'.

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

get_account_infoC

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

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription
loginYes
nameYes
serverYes
currencyYes
balanceYes
equityYes
marginYes
margin_freeYes
margin_levelYes
leverageYes
trade_allowedYes
margin_modeYes

TDQS

C2.8/5.0
Behavior2/5

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

No annotations provided. The description does not disclose any behavioral traits (e.g., read-only, authentication needs). A read tool with zero parameters should at least confirm it is safe and non-destructive.

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?

Single concise line with no wasted words. However, it is not front-loaded with the purpose; starting with 'Balance' is unclear without context.

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

Completeness2/5

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

Despite having an output schema, the description fails to state the tool's primary action (retrieving account info). It only lists what might be returned, which is insufficient for complete understanding.

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?

Zero parameters so baseline is 4. The description lists output fields but does not add parameter meaning; however, with no parameters, this is acceptable.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description lists data fields (balance, equity, etc.) but does not explicitly state that the tool retrieves account information. The tool name provides context, but the description is vague and could be interpreted as a list of parameters rather than an action.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus siblings like get_orders or get_positions. There is no differentiation or context for appropriate use.

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

get_historyB

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

ParametersJSON Schema
NameRequiredDescriptionDefault
from_tsYes
to_tsYes
symbolNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.3/5.0
Behavior2/5

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

No annotations provided, so the description must fully disclose behavior. It mentions time range and timestamp format but omits details like read-only nature, pagination, ordering, rate limits, or response structure. The existence of an output schema partially mitigates, but behavioral traits are under-described.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise: one sentence for purpose, one for format constraint. No redundancy, front-loaded with main action. Every word earns its place.

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

Completeness3/5

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

The tool is simple with 3 params and an output schema. The description covers the main purpose and timestamp format but misses the symbol parameter and any behavioral notes. Given output schema exists, it's adequate but not complete.

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 coverage is 0%, so the description must compensate. It explains the two required timestamps (format and range) but does not mention the optional 'symbol' parameter. Thus it partially adds value but leaves a gap.

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?

The description clearly states the tool retrieves closed deals/trades within a time range. The phrase 'Closed deals' distinguishes it from siblings like get_positions (open positions) and get_orders. The verb is implied (get/list), and the resource is precise.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is given on when to use this tool versus alternatives. With many sibling tools, explicit context like 'Use for historical trades, not current positions' would help. The description only states the action without usage context.

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

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.

ParametersJSON Schema
NameRequiredDescriptionDefault
symbolYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
symbolYes
is_openYes
next_openYes
next_closeYes

TDQS

A4.5/5.0
Behavior5/5

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

With no annotations, the description fully discloses behavior: how is_open is derived (trade_mode), that next_open and next_close are always None in v1, and that precise session boundaries are not available. This is highly transparent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise (4 sentences) and front-loaded. The first sentence states the primary purpose, followed by limitations and alternative guidance. Every sentence adds value without redundancy.

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?

The description covers the main output fields (is_open, next_open, next_close) and their constraints. Given the presence of an output schema and the tool's simplicity, the description is complete.

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 coverage is 0%, and the description adds no detail about the 'symbol' parameter beyond using the term. However, the parameter name and tool context make its meaning clear. The description does not provide additional semantic value.

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?

The description clearly states the tool's purpose: 'Whether the given symbol's session is open right now.' It uses a specific verb and resource, and distinguishes this tool from siblings like get_quote or get_symbols by focusing on session open status.

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?

The description provides context on when to use this tool (for checking if session is open) and when to use alternatives (for precise session boundaries, consult broker's schedule). It does not explicitly name alternative tools but gives clear usage context.

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

get_ordersB

Pending orders, optionally filtered to a single symbol.

ParametersJSON Schema
NameRequiredDescriptionDefault
symbolNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.1/5.0
Behavior2/5

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

No annotations are provided, so the description carries full burden. It does not disclose whether the tool is read-only, has side effects, requires authentication, or returns paginated results. The term 'pending orders' mildly implies a read operation, but this is not explicit, leaving uncertainty about the tool's behavior.

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?

The description is extremely concise (6 words) and front-loaded, stating the core functionality immediately. It avoids unnecessary words, though it could be slightly more descriptive without becoming wordy.

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

Completeness3/5

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

Given the low complexity (1 optional parameter) and the presence of an output schema, the description is minimal but covers the essential use case. It does not mention what happens when no symbol is provided (returns all pending), potential rate limits, or the structure of the response, but the output schema likely covers return details.

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?

With 0% schema description coverage, the description adds value by explaining that the single optional parameter 'symbol' serves as an optional filter. This clarifies the parameter's purpose beyond the schema's mere name and type. No other parameters exist, so coverage is adequate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description specifies 'Pending orders' which clearly indicates the resource (pending orders) and implies the action of retrieving them. The optional filter to a single symbol is explicitly stated. However, the verb (e.g., 'list' or 'retrieve') is implicit rather than explicit, and it does not differentiate from siblings like `get_history` (completed orders) or `get_positions` (open positions).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives such as `get_history`, `get_positions`, or `get_quote`. It does not mention any prerequisites or constraints (e.g., requiring an active session) and does not indicate when to avoid using it.

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

get_positionsC

Open positions, optionally filtered to a single symbol.

ParametersJSON Schema
NameRequiredDescriptionDefault
symbolNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

C2.8/5.0
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It does not state that this is a read-only operation, whether results are paginated, or any authentication requirements. The description is too brief to offer meaningful transparency beyond the basic purpose.

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?

The single-sentence description is concise and front-loads the core purpose. Every word serves a purpose, but it could be slightly more structured (e.g., separate the main action from the filter option). Word count is appropriate for a simple tool.

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

Completeness3/5

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

Given the tool's simplicity (one optional parameter, output schema exists), the description covers the essential points: what is returned and the filter option. However, it omits details like what fields are in the output, any default behavior (all positions vs. only open?), and limits. It is minimally acceptable.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate. It adds value by clarifying that the symbol parameter is optional for filtering, but it does not explain acceptable formats (e.g., ticker vs. full name), case sensitivity, or what happens if an invalid symbol is provided.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool returns 'Open positions' and mentions the optional filter by symbol, distinguishing it from sibling tools like get_orders or get_history. However, it lacks an explicit verb like 'retrieve' or 'list', relying on the tool name for action context.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides minimal guidance: only that the symbol parameter is optional. It fails to indicate when this tool should be used over alternatives (e.g., get_account_info for overall account status) or any prerequisites. No exclusions or when-not-to-use advice is given.

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

get_quoteA

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

ParametersJSON Schema
NameRequiredDescriptionDefault
symbolYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
symbolYes
bidYes
askYes
timeYes

TDQS

A3.5/5.0
Behavior3/5

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

Discloses the side effect of preparing the symbol in Market Watch if needed. With no annotations, this is useful but lacks details like error handling or state changes.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences front-loading purpose and behavior. No extraneous words, efficient communication.

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?

For a simple tool with one parameter and an output schema, the description covers purpose and a key side effect. It is sufficient for basic usage but could include failure conditions or rate limiting.

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

Parameters2/5

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

The only parameter 'symbol' has no schema description and the tool description provides only minimal context ('for a symbol'), adding little beyond the parameter name. No format or example given.

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?

Clearly states it retrieves the current bid/ask for a symbol, which is specific and distinct from sibling tools like get_rates. The verb 'get' and resource 'quote' are explicit.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives such as get_rates. The description does not mention prerequisites, exclusions, or typical scenarios.

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

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].

ParametersJSON Schema
NameRequiredDescriptionDefault
symbolYes
timeframeYes
countYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.3/5.0
Behavior4/5

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

No annotations are provided, so description carries full burden. It discloses that output is OHLC bars, ordered by recency, and count is clamped. This is good for a read-only tool, but could add that it does not modify data or mention error handling. Overall, behavioral traits are clearly conveyed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Description is two sentences, front-loaded with core purpose in first sentence. Every sentence provides necessary information without redundancy. Highly efficient.

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?

For a simple data retrieval tool with output schema, description covers parameter semantics and basic behavior. It could mention error handling or data availability for invalid symbols, but the current level is adequate. Lacks explicit sibling differentiation, but otherwise complete.

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%, but description fully compensates: it explains symbol is an instrument, timeframe has specific values (M1, etc.), and count is an integer with range [1,5000]. This adds significant meaning beyond schema titles.

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?

Description clearly states it returns OHLC bars for a symbol and timeframe, most recent first. It uses specific verb and resource, and implicitly distinguishes from siblings like get_quote (single price) and get_history (likely more general history). No ambiguity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Description provides timeframe options and count clamping, which gives some usage context, but does not explicitly tell when to use this tool over siblings such as get_history or get_quote. No 'use this for X, but Y for Z' guidance.

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

get_symbolsA

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

ParametersJSON Schema
NameRequiredDescriptionDefault
categoryNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.7/5.0
Behavior2/5

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

With no annotations provided, the description carries the full burden. It only states a read operation with optional filtering, but does not disclose whether the list is complete, account-dependent, or if there are rate limits.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence with no unnecessary words. It front-loads the main action 'List tradeable instruments' and then adds filtering detail, earning its place.

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

Completeness3/5

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

Given the existence of an output schema, the description need not detail return format. However, it lacks guidance on when to use this tool (e.g., before placing an order) and does not address potential concerns like rate limits or pagination.

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?

The schema coverage is 0%, meaning the JSON schema has no description for the 'category' parameter. The description adds value by explaining that this parameter filters results and provides examples like 'Forex' and 'Metals'.

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?

The description uses a specific verb 'List' and resource 'tradeable instruments', clearly distinguishing it from siblings like get_quote or get_orders by stating it returns a list of available trading symbols.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage via 'optionally filtered by category' but does not explicitly state when to use this tool versus siblings, such as for discovering available symbols before trading. No when-not or alternatives are mentioned.

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

get_terminal_infoB

MT5 terminal connection state and broker TZ offset.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription
connectedYes
buildYes
nameYes
companyYes
loginYes
serverYes
broker_tz_offset_minutesYes
latency_msYes

TDQS

B3.3/5.0
Behavior3/5

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

No annotations provided, so the description carries full burden. It states it returns connection state and TZ offset, implying a read-only operation, but does not disclose authentication requirements, potential errors, or idempotency. The brief description is adequate but not detailed.

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?

The description is extremely concise at 7 words, with every word providing value. It is front-loaded with the key information. However, it could be slightly expanded for clarity without losing conciseness.

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

Completeness3/5

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

Given no parameters and an output schema, the description is minimally adequate. It names the two main output categories but lacks optional details like error conditions or typical return structure. For a simple tool, it is sufficient but not enriched.

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?

No parameters exist, so schema coverage is 100% trivially. The description does not need to add parameter meaning. Baseline score of 4 for zero parameters is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it returns MT5 terminal connection state and broker TZ offset. It is specific about the resource and data, though it omits an explicit verb like 'Get' or 'Retrieve'. It is distinguishable from siblings like get_account_info which focuses on account details, but the distinction is implicit.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives. There is no mention of prerequisites, typical use cases, or contexts (e.g., before trading). The description provides no exclusions or alternatives.

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

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.

ParametersJSON Schema
NameRequiredDescriptionDefault
ticketYes
slNo
tpNo
priceNo
expirationNo
idempotency_keyNo
approval_confirmedNo
approval_request_idNo

TDQS

A3.7/5.0
Behavior4/5

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

With no annotations, the description carries the full burden. It discloses the approval condition based on policy settings, which is a key behavioral trait. However, it does not detail other constraints like required permissions or error scenarios.

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?

The description is front-loaded with the purpose and uses a separate paragraph for the behavioral nuance. It is concise but could be slightly more streamlined without losing clarity.

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

Completeness2/5

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

With 8 parameters and no output schema, the description covers the main functionality and one behavioral nuance but leaves several parameters undocumented (e.g., idempotency_key) and provides no details on return values or error handling.

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?

The description adds meaning for sl, tp, price, expiration, and approval fields by explaining their roles in modifying orders. However, it does not cover idempotency_key, and the schema coverage is 0%, so more detail could be beneficial.

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?

The description clearly states the tool modifies SL/TP on positions or price/expiration on pending orders. It distinguishes from siblings like place_order, cancel_order, and close_position.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explains the consent gate behavior but does not explicitly guide when to use this tool versus alternatives (e.g., place_order for new orders, cancel_order for cancellations). The usage context is implicit.

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

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.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4.9/5.0
Behavior5/5

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

Despite no annotations, description fully discloses return structure (ok, latency_ms, via), behavior of 'via', and cost implication ('cheap'). No contradictions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Extremely concise: three short sentences covering purpose, return format, and usage hint. No wasted words, front-loaded with main purpose.

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?

Tool is simple (no params, clear output), and description fully covers all aspects: purpose, return schema, usage guidance. Output schema exists, but description adds usage context.

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?

No parameters exist, so baseline 4 applies. Description adds no parameter info, but none is needed given zero parameters.

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?

Clearly states it's a health check for MT5 terminal reachability, with specific verb 'Health check' and resource 'MT5 terminal'. Distinct from all sibling tools which are operational or data retrieval tools.

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?

Explicitly advises agents to call after idle periods or errors suggesting disconnection, providing clear usage context. Also notes it's cheap, aiding decision-making.

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

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.

ParametersJSON Schema
NameRequiredDescriptionDefault
symbolYes
sideYes
typeYes
volumeYes
priceNo
stop_limit_priceNo
slNo
tpNo
deviationNo
commentNo
idempotency_keyNo
approval_confirmedNo
approval_request_idNo

TDQS

A3.7/5.0
Behavior4/5

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

With no annotations, the description discloses key behaviors: the approval mechanism for large notional orders, idempotency support via idempotency_key, and auto-execution default. However, it does not explain what the 'deviation' parameter does or mention error handling.

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?

The description is concise with three sentences. The first sentence front-loads the core purpose. While it could be more structured (e.g., bullet points), it avoids unneeded detail and is clear.

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

Completeness3/5

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

Given the complexity (13 parameters, no output schema, no annotations), the description covers main behavior and the approval flow but omits details like return values, validation rules, and the meaning of 'deviation'. It is adequate but not comprehensive.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate. It mentions SL, TP, deviation, approval_confirmed, and idempotency_key, but fails to describe symbol, side, type, volume, price, stop_limit_price, and comment. Only partial parameter meaning is provided.

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?

The description clearly states 'Place a market or pending order' with specific verb and resource. It distinguishes from siblings like cancel_order, modify_order, get_orders by focusing on order creation. The mention of optional SL/TP/deviation adds specificity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies use for new orders but does not explicitly state when to use this tool vs alternatives (e.g., modify_order for existing orders). No when-not-to-use guidance is provided, though the context is clear.

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

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 15 tool updatesv1.3.1
    • First observedcalc_margin
    • First observedcancel_order
    • First observedclose_position
    • First observedget_account_info
    • First observedget_history
    • First observedget_market_hours
    • First observedget_orders
    • First observedget_positions
    • First observedget_quote
    • First observedget_rates
    • First observedget_symbols
    • First observedget_terminal_info
    • First observedmodify_order
    • First observedping
    • First observedplace_order

TDQS

A3.7/5.0

Scored across 15 tools

Disambiguation5/5

Each tool targets a distinct trading operation: margin calculation, order management, position closing, account info, market data retrieval, health check, etc. There is no functional overlap between tools.

Naming Consistency5/5

Tool names consistently follow a verb_noun pattern (e.g., get_quote, place_order, close_position). The only exception is 'ping', which is a standard minimal verb for health checks, maintaining overall consistency.

Tool Count5/5

15 tools is well-suited for an MT5 server, covering essential operations like account info, market data, order lifecycle, and positions. It is neither too sparse nor overly heavy.

Completeness4/5

The tool set covers the core trading lifecycle (market data, order placement/cancellation/modification, position closing, history) and account info. Minor gaps exist (e.g., trailing stops or news), but the essential functionality is present.

Maintenance

ActivitySlowing
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    A Model Context Protocol (MCP) server that provides AI assistants like Claude with direct access to MetaAPI trading platform. Trade forex, stocks, and commodities through natural language conversations.
    1
    -
  • A
    license
    Not graded
    quality
    C
    maintenance
    A local-first MCP server that bridges AI coding agents with MetaTrader 5 for inspection, market data, MQL5 development, compiling, Strategy Tester review, workspace sync, logs, audit trails, demo trading, and carefully gated live trading.
    MIT
  • A
    license
    Not graded
    quality
    A
    maintenance
    MCP server for AI agents to inspect and trade against a MetaTrader 4 terminal, with an offline mock mode for CI and demos.
    2
    MIT

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