Skip to main content
Glama

analyze_mql

Read-onlyIdempotent

Perform static checks on MQL4/5 source to detect structural lint issues, deprecated API usage, and complexity metrics without compiling.

Instructions

Static checks on MQL source without compiling: structural lint (missing OnInit/OnTick, unused inputs, hardcoded magic/symbol), MT4-style deprecated API calls with MT5 replacements, and size/nesting metrics.

Replaces lint_basic / check_deprecated / code_metrics. Use compile(syntax_only=true) for real compiler diagnostics.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
rootNoAbsolute folder to aggregate metrics over every MQL file (metrics check only).
checksNoWhich checks to run; default all.
sourceNoAbsolute path to one .mq4/.mq5/.mqh file.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.5.0

TDQS

A4.7/5.0
Behavior4/5

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

Annotations already declare the tool read-only and idempotent; the description adds that it performs static analysis without invoking the compiler, so no compile artifacts or compiler errors are produced. It also reveals that the deprecated check includes MT5 replacements, not just a list of issues. There is no contradiction with annotations.

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, no filler: the first is front-loaded with core behavior and scope, and the second gives routing guidance. Every sentence earns its place.

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?

For a three-parameter tool with a full input schema, an output schema, and read-only/idempotent annotations, the description covers purpose, scope, check semantics, and the key alternative. The only implied detail, that root is metrics-only, is already supplied by the schema's parameter description.

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?

All three parameters are described in the schema with 100% coverage, so the description does not need to re-explain root/source/checks. It does add meaning for the checks enum by explaining what 'lint', 'deprecated', and 'metrics' actually cover, while the schema handles the file/folder distinction.

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 ('analyze') and resource ('MQL source'), explicitly scopes it to 'without compiling', and enumerates the three check families: structural lint, deprecated API calls with MT5 replacements, and size/nesting metrics. This clearly distinguishes it from compile and from the legacy lint/deprecated/metrics siblings.

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?

It explicitly says it 'Replaces lint_basic / check_deprecated / code_metrics', telling the agent not to use the older siblings for these checks. It also routes compiler diagnostics to `compile(syntax_only=true)`, giving an explicit alternative condition.

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