Skip to main content
Glama
dchumari
by dchumari

Write an MQL5 source file

write_file

Create or overwrite MQL5 files (.mq5, .mqh, .mqproj, .set) in the sandboxed MQL5 data folder, optionally creating missing directories and replacing existing files.

Instructions

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.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes
contentYes
overwriteNo
createDirsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

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.