Skip to main content
Glama
dchumari
by dchumari

metaeditor5-mcp

MCP server that lets an AI author MQL5 Expert Advisors/indicators/scripts, compile them with MetaEditor's CLI, and backtest them with MetaTrader 5's Strategy Tester — without a human driving the MetaEditor/MetaTrader GUI.

What this does and doesn't do

  • Does: write/read/list/delete .mq5/.mqh/.mqproj/.set files under the MetaTrader data folder's MQL5 tree, compile them via MetaEditor64.exe /compile, and run them through the Strategy Tester via terminal64.exe /config for historical backtesting.

  • Doesn't: attach an EA to a live/demo chart or place any real order. Backtesting is a closed historical simulation with no live connection. Deploying an EA to actually trade is a manual step in the MetaTrader terminal GUI, and this project intentionally does not automate it.

  • Doesn't: accept arbitrary/absolute filesystem paths. Every path-taking tool only accepts paths relative to the MQL5 sandbox root (Experts, Include, Indicators, Scripts, Libraries, Files), validated to reject .. traversal and anything resolving outside it.

Related MCP server: mt5-mcp

Requirements

  • Windows. MetaEditor/MetaTrader 5 desktop only ships for Windows, and this server shells out to MetaEditor64.exe/terminal64.exe directly, so it only runs on Windows (including inside a Windows VM) — not macOS/Linux, even if MT5 is run there under Wine.

  • MetaTrader 5 installed (which includes MetaEditor). Any broker's installer works — the server doesn't hardcode any broker.

  • Node.js 18+.

Setup

git clone https://github.com/dchumari/metaeditor5-mcp.git
cd metaeditor5-mcp
npm install
npm run build

Add to Claude Code's MCP config (.mcp.json), replacing the path below with the absolute path to wherever you cloned this repo:

{
  "mcpServers": {
    "metaeditor5": {
      "command": "node",
      "args": ["C:\\path\\to\\metaeditor5-mcp\\dist\\index.js"]
    }
  }
}

The server auto-detects your MetaTrader 5 installation and its data folder by scanning %APPDATA%\MetaQuotes\Terminal\*\origin.txt. If you have more than one installation, set MCP_MT5_INSTALL_DIR to the one you want (e.g. C:\Program Files\MetaTrader 5), or pass installDirHint to the get_environment_info tool.

Backtesting requires an account login

Verified empirically: MetaTrader's Strategy Tester refuses to start with no account specified ("tester not started because the account is not specified"), even for a pure historical simulation. To use run_backtest, log into any demo or live account in the MetaTrader 5 terminal (File → Login to Trade Account, or open a new demo account) with "Save my login details" checked.

That's normally the only setup step needed: run_backtest resolves the login to use, in order, from (1) the login argument, (2) the MCP_MT5_LOGIN environment variable, (3) the account number MetaTrader already has saved as its current login (read from config/common.ini's Login= key — verified working end-to-end). Set MCP_MT5_LOGIN explicitly only if you have multiple saved accounts and the terminal's current one isn't the one you want used. The account's password is never read, stored, or passed by this server — it relies entirely on MetaTrader's own saved/remembered credentials for that login. Never pass a password through an MCP tool call.

First backtest for a new symbol/date range may need a retry. Verified on a fresh demo account: the Strategy Tester downloads missing history from the broker in the background, but its own internal timeout for that (~18s) can be shorter than one authentication round-trip on a fresh connection, causing the first attempt to fail with "no history data" even though the download is actually still happening (visible as growing .hcc files under bases/<server>/history/<symbol>/). Simply calling run_backtest again against the same symbol/range once it's downloaded resolves it.

Environment variables

Variable

Purpose

MCP_MT5_INSTALL_DIR

Pin the MT5 install directory if more than one is found

MCP_MT5_LOGIN

Account number for Strategy Tester runs (see above)

MCP_MT5_COMPILE_TIMEOUT_MS

Compile timeout (default 120000)

MCP_MT5_BACKTEST_TIMEOUT_MS

Backtest timeout (default 600000)

Tools

Tool

Purpose

get_environment_info

Resolve/re-resolve the MT5 install + data folder

list_files

List files/dirs under the MQL5 sandbox

read_file

Read a source file

write_file

Create/overwrite a source file

delete_file

Delete a single file

compile

Compile via MetaEditor CLI, parsed errors/warnings + .ex5 path

run_backtest

Run the Strategy Tester, parsed performance metrics

get_journal

Read the MQL5 journal log

Development

npm test                # unit tests (sandbox, log parser, ini builder, report parser)
npm run dry-run -- env  # exercise modules directly, no MCP client needed
npm run smoke-test      # write -> compile -> (backtest if MCP_MT5_LOGIN set) -> cleanup
npm run dev             # run the server directly with tsx, for local iteration

Verified end-to-end

Both compile and run_backtest have been run for real against a live MetaTrader 5 installation (build 6182) with a demo account, through the actual MCP server over stdio, not just their underlying modules:

  • compile's log format (src/compile/logParser.ts) was verified against real MetaEditor64.exe /log output, including a clean compile and one with an error and a warning — see test/logParser.test.ts for the captured fixture. Exit codes were confirmed unreliable (one run exited 1 with zero errors, another exited 0 with a real error), which is why success is derived only from the parsed log plus a freshly-written .ex5.

  • run_backtest's report parsing (src/backtest/reportParser.ts) was verified against a real Strategy Tester report. Two bugs surfaced only through this real run and are now fixed: Expert= needs Windows backslashes (a forward-slash value is silently ignored, and the terminal falls back to whichever EA it last remembers running — no error at all), and the report is written directly to the data folder root rather than under Tester/ as might be assumed (it's now parsed there, then moved into the sandboxed Files/.mcp/ scratch dir so repeated runs don't litter your live MetaTrader data folder). The real report's labels matched LABEL_MAP's guesses exactly for this build; if a different build/locale doesn't, the result's raw field always carries every parsed label/value pair regardless, so nothing is silently lost — extend LABEL_MAP from there if needed.

Available Tools

8 tools
compileCompile an MQL5 fileA

Compiles a .mq5/.mqh/.mqproj file via MetaEditor's CLI and returns structured errors/warnings parsed from the compile log, plus the resulting .ex5 path on success. Success requires both zero parsed errors AND a freshly-written .ex5 (the process exit code is not trustworthy and is ignored).

ParametersJSON Schema
NameRequiredDescriptionDefault
pathYese.g. "Experts/Advisors/MyEA.mq5"
timeoutMsNo
includePathNo

TDQS

A4.1/5.0
Behavior5/5

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

With no annotations, the description carries the full behavioral burden well. It discloses that compilation happens via MetaEditor CLI, that structured errors/warnings are parsed from the compile log, that success requires both zero parsed errors and a freshly-written .ex5, and that the process exit code is deliberately ignored.

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 compact sentences, front-loaded with the action and return value, followed by the critical success-condition caveat. Every sentence earns its place.

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?

Despite no annotations and no output schema, the description explains the return values and the non-obvious success criteria. It remains incomplete only around the two optional, undocumented parameters (timeoutMs and includePath).

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 only 33%, so the description needs to compensate for undocumented parameters, but it does not mention timeoutMs or includePath at all. It adds no parameter semantics beyond what the schema already provides for path.

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 (compiles), the exact resource types (.mq5/.mqh/.mqproj), the mechanism (MetaEditor CLI), and the return shape (structured errors/warnings plus .ex5 path). It is clearly distinguishable from the file-operation and backtest siblings.

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 the tool is for compiling MQL5 source files but gives no explicit when-to-use, when-not-to-use, or alternative-tool guidance. The file-type scope provides some context, but selection guidance is mostly inferred.

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

delete_fileDelete an MQL5 source fileB

Deletes a single file (not a directory) under the sandboxed MQL5 data folder.

ParametersJSON Schema
NameRequiredDescriptionDefault
pathYes

TDQS

B3.4/5.0
Behavior3/5

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

With no annotations, the description carries the full behavioral burden. It does disclose the destructive nature of the operation and the sandboxed scope, which are useful constraints, but it omits irreversibility, behavior when the path does not exist, and any permission or error semantics.

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?

A single front-loaded sentence with no padding or redundancy. It is efficient, though its brevity is partly under-specification rather than genuine discipline.

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?

For a destructive, unannotated tool with no output schema and an undocumented path parameter, the description is too thin: it should cover path format, failure behavior for missing files, and confirm the deletion is irreversible. Only the scope constraint is provided.

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% for the single 'path' parameter, so the description must compensate and does not. It never states whether 'path' is relative to the sandbox root or absolute, nor what path syntax is accepted.

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 ('deletes a single file') and immediately scopes it with two constraints: the target must be a file, not a directory, and it lives under the sandboxed MQL5 data folder. Among siblings named list_files, read_file, write_file, compile, etc., a delete operation is unambiguously distinct.

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?

Usage is only implied by the name and the 'single file (not a directory)' qualifier; there is no explicit statement of when to use this versus write_file or how to recover from a wrong deletion. No alternatives or prerequisites are named, so an agent must infer the context.

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

get_environment_infoGet MetaTrader 5 environment infoA

Resolves (or re-resolves) the MetaEditor/MetaTrader 5 installation and its MQL5 data folder. Call this first, and again if you get an 'ambiguous' or 'error' result, passing installDirHint.

ParametersJSON Schema
NameRequiredDescriptionDefault
installDirHintNoAbsolute path to the MT5 install dir, e.g. C:\Program Files\MetaTrader 5

TDQS

A4.6/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 and does well: it discloses idempotent-like re-resolution behavior, required call ordering, and the failure states ('ambiguous', 'error') an agent will encounter. It stops short of stating that the operation has no side effects or what a successful resolution returns.

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 tight sentences, no filler, and the primary action ('call this first') is front-loaded ahead of the conditional retry case.

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?

No output schema exists, so the description should ideally hint at return states; it does by naming 'ambiguous' and 'error' outcomes, which is useful. It omits what a successful resolution returns (the resolved install/data paths), a minor remaining gap for a resolution tool.

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% and the schema already documents the installDirHint format, so the baseline is 3. The description adds genuine value beyond the schema by explaining why and when to pass it (to disambiguate a failed resolution), which the schema description does not convey.

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 ('resolves/re-resolves') and a precise resource ('MetaEditor/MetaTrader 5 installation and its MQL5 data folder'). This is unambiguous and clearly distinct from every sibling, which are all file/compile/execution operations.

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 ordering guidance ('Call this first') and an explicit re-invocation condition ('again if you get an ambiguous or error result'). The triggering states are named, so an agent knows exactly when to invoke and re-invoke with no inference required.

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

get_journalRead the MQL5 journal logB

Reads the terminal's MQL5 journal log for a given date (defaults to the latest).

ParametersJSON Schema
NameRequiredDescriptionDefault
dateNoYYYYMMDD; defaults to the most recent log
tailLinesNo

TDQS

B3.3/5.0
Behavior3/5

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

No annotations are provided, so the description carries the full disclosure burden. It usefully reveals that a missing date defaults to the most recent log, but says nothing about failure modes (no log for date), permissions, or log size/volume concerns.

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 front-loaded sentence with no waste; the resource and its default behavior are stated immediately.

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?

For a two-parameter read tool with no output schema and no annotations, the description covers the primary path but leaves tailLines entirely unexplained and gives no hint about what the log output looks like or how it fails.

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 50%: the schema documents the date format (YYYYMMDD) and default, while tailLines is undocumented in both schema and description. The description restates the date default but adds nothing about tailLines or the parameter's truncation behavior.

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 names a specific verb ("Reads") and a specific resource ("the terminal's MQL5 journal log"), which cleanly separates it from the generic file tools in the sibling list. It stops short of explicitly contrasting itself with read_file/list_files, so an agent must infer the distinction.

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?

There is no guidance on when to prefer this over read_file/list_files, nor any exclusions or prerequisites. The only usage signal is the incidental "defaults to the latest," which falls short of actual when-to-use guidance.

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

list_filesList MQL5 source filesA

Lists files/directories under the sandboxed MQL5 data folder (Experts, Include, Indicators, Scripts, Libraries, Files). Omit dir to see the top-level allowed folders.

ParametersJSON Schema
NameRequiredDescriptionDefault
dirNoRelative dir, e.g. "Experts/Advisors". Omit for top level.
recursiveNo

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 carries the full burden. It usefully discloses the sandboxed/restricted scope and the enumerated allowed folders, but says nothing about recursion defaults, pagination, ordering, or what the listing actually returns. Sandbox context is real added value, but key behavioral traits are absent.

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 tightly written sentences with the scope constraint front-loaded and the parameter hint second; every clause earns its place and nothing is redundant.

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?

For a simple two-parameter read tool it covers purpose and scope adequately, but with no annotations and no output schema the description should at least explain the recursive flag and the shape of the result. Those gaps leave the agent guessing on a non-trivial option.

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 50%: 'dir' is documented in both places, while 'recursive' has no description in either the schema or the tool description. The description reinforces the dir semantics (relative path, omit for top level) and names the folder set, but leaves recursive 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?

States a specific verb (Lists) and resource (files/directories) and names the exact sandboxed scope (the MQL5 data folder) plus its allowed subfolders. An agent can distinguish this from read_file, write_file, and delete_file without opening any schema.

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?

Gives one actionable hint ('Omit dir to see the top-level allowed folders'), which is usage guidance for a parameter rather than for the tool as a whole. No alternatives or when-not conditions are named, and none are obvious among the siblings, so this is implied usage rather than explicit guidance.

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

read_fileRead an MQL5 source fileA

Reads a text file (e.g. .mq5/.mqh) from under the sandboxed MQL5 data folder.

ParametersJSON Schema
NameRequiredDescriptionDefault
pathYese.g. "Experts/Advisors/MyEA.mq5"

TDQS

A4/5.0
Behavior3/5

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

With no annotations provided, the description carries the full behavioral burden. It usefully discloses that the scope is sandboxed and text-only, but it omits permissions, error behavior, encoding, size limits, and whether the operation is strictly read-only, leaving key operational traits unstated.

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 definition is a single front-loaded sentence with no wasted words. The scope constraint and examples are included immediately, making it easy for an agent to parse.

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 one-parameter read tool, the schema fully documents the path and the description supplies the sandbox scope and file-type context. The only minor gap is that it does not explicitly describe the return value, though 'Reads a text file' strongly implies file contents.

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 description coverage is 100% and the path parameter already has an example. The description still adds meaning by clarifying that the file must live under the sandboxed MQL5 data folder and by naming expected source-file extensions (.mq5/.mqh), which goes beyond the schema's bare example string.

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 gives a specific verb ('Reads'), a resource ('text file'), an examples list (.mq5/.mqh), and a clear scope ('sandboxed MQL5 data folder'). This is sufficient to distinguish it from sibling tools such as write_file, delete_file, and list_files without opening a schema.

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 sandboxed MQL5 data folder context implies when the tool is appropriate for reading source files, but there is no explicit guidance on when to use it versus list_files for discovery or write_file for modification. No exclusions or prerequisites are stated.

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

run_backtestRun a Strategy Tester backtestA

Runs a compiled EA through MetaTrader's Strategy Tester (a closed historical simulation - no live connection, no real orders) and returns parsed performance metrics. Requires the EA to already be compiled (call compile first). Requires an account login: the Strategy Tester refuses to start without one. Resolution order: the login argument, then MCP_MT5_LOGIN, then whichever account is currently saved/logged into this terminal (from common.ini) - so if you're already logged into a demo/live account with 'save password' checked, no login needs to be passed at all.

ParametersJSON Schema
NameRequiredDescriptionDefault
loginNoMT5 account number; falls back to MCP_MT5_LOGIN
modelNo
periodYese.g. M15, H1, D1
symbolYes
toDateYesYYYY.MM.DD
depositNo
currencyNo
fromDateYesYYYY.MM.DD
leverageNoe.g. "1:100"
timeoutMsNo
expertPathYesRelative to Experts/, no extension, e.g. "Advisors/ExpertMACD"
executionModeNo

TDQS

A4/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 and does well on safety-critical behavior: it explicitly says no live connection and no real orders, and it explains that the Strategy Tester refuses to start without an account login. It does not disclose whether the test mutates terminal state or the meaning of timeoutMs, leaving some behavioral gaps.

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-loads what the tool does and follows with prerequisites and the login resolution chain, with no filler sentences. The login paragraph is dense but each detail (fallback order) is actionable rather than redundant.

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?

For a 12-parameter tool with no output schema and no annotations, the description is reasonably complete on purpose and preconditions but leaves several input capabilities unexplained and only vaguely states it 'returns parsed performance metrics' without indicating which metrics. Adequate but with clear gaps for a tool of this complexity.

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 only 50%, so the description must compensate and largely does for login: it details the full resolution order (argument, MCP_MT5_LOGIN, then the account saved in common.ini) beyond the schema's terse fallback note. However, it adds nothing for model, deposit, currency, leverage, and executionMode, which remain undocumented.

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 (runs a compiled EA through MT5's Strategy Tester) and immediately bounds the scope as a closed historical simulation with no live connection and no real orders. This cleanly separates it from siblings like compile and get_journal.

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 concrete prerequisite and routes the agent to the needed alternative: 'Requires the EA to already be compiled (call compile first).' It also flags the account-login requirement, but does not describe when this tool is a poor choice versus other tools beyond the compile dependency.

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

write_fileWrite an MQL5 source fileA

Creates or overwrites a .mq5/.mqh/.mqproj/.set file under the sandboxed MQL5 data folder (e.g. write an EA to "Experts/MyStrategy/MyEA.mq5"). Set overwrite:true to replace an existing file.

ParametersJSON Schema
NameRequiredDescriptionDefault
pathYes
contentYes
overwriteNo
createDirsNo

TDQS

A3.6/5.0
Behavior3/5

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

With no annotations, the description carries the full behavioral burden. It usefully discloses the sandboxed data-folder scope and the allowed file types, but omits critical behavior: what happens if the target exists and overwrite is not set (error vs silent no-op), and whether createDirs is needed for missing parent folders.

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 tightly written sentence with the scope constraint front-loaded and the example inline; every clause earns its place with no filler.

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?

For a mutation tool with no annotations and no output schema, the description is only partially complete. It should state the default behavior when overwriting an existing file without the flag and whether directories are auto-created, which are the main risks an agent would hit.

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% across 4 parameters, so the description must compensate. It covers path (with an example) and the semantics of overwrite, but says nothing about content or createDirs, leaving two of four parameters undefined anywhere.

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 (creates/overwrites) and a precise resource (a .mq5/.mqh/.mqproj/.set file under the sandboxed MQL5 data folder), with a concrete example. This clearly distinguishes it from the sibling read/list/delete file tools.

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?

It gives a conditional for replacing an existing file (overwrite:true), which is the key usage decision, but never states when to use this versus delete_file or read_file, nor any exclusions or prerequisites. Usage is implied rather than spelled out.

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.

  1. 8 tool updatesv0.1.0
    • First observedcompile
    • First observeddelete_file
    • First observedget_environment_info
    • First observedget_journal
    • First observedlist_files
    • First observedread_file
    • First observedrun_backtest
    • First observedwrite_file

TDQS

A3.9/5.0

Scored across 8 tools

Disambiguation5/5

Each tool has a clearly distinct purpose: file CRUD (list/read/write/delete), environment setup, compile, backtest, and journal reading. The file tools all target the same resource but with unambiguous distinct verbs, and the build/run/log tools occupy separate roles with no overlap.

Naming Consistency4/5

Most names follow a clean verb_noun pattern (list_files, read_file, write_file, delete_file, get_environment_info, get_journal, run_backtest). Two are bare verbs (compile, run_backtest partially) which is a minor deviation but still readable and predictable.

Tool Count5/5

Eight tools is well-scoped for an MQL5 file+compile+backtest workflow, with each tool earning its place covering a distinct stage of the author-test loop.

Completeness4/5

File read/write/delete, compile, backtest, and journal cover the core edit-build-test lifecycle completely. Minor gaps exist (no explicit directory creation, rename/move, or file search), but write_file's path handling likely covers directory needs for most workflows.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables AI assistants to trade on MetaTrader 5 using natural language, supporting account management, order placement, and real-time market data.
    1
    MIT
  • 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
    B
    quality
    B
    maintenance
    Enables LLM agents to compile, deploy, backtest, and analyze MetaTrader 4/5 MQL sources without touching the MetaTrader UI, leveraging the build pipeline.
    41
    MIT
  • A
    license
    B
    quality
    B
    maintenance
    Quantitative research MCP server that lets AI define strategies and uses MetaTrader 5's official Strategy Tester to execute backtests, managing experiments and results via tools like run_backtest, get_run, and compare_runs.
    18
    MIT