Refactor handlers into SRP modules and add indicator/script tools

**Handler Refactoring:**
- Split monolithic handlers.rs (1468 lines) into 7 focused modules:
  - system.rs: verify_setup, healthcheck, list_symbols
  - experts.rs: list_experts, list_indicators, list_scripts, compile_ea
  - backtest.rs: run_backtest, get_backtest_status, cache_status, clean_cache
  - optimization.rs: run_optimization, get_optimization_results, list_jobs
  - analysis.rs: analyze_report, compare_baseline
  - setfiles.rs: read/write/patch/clone/diff set files
  - reports.rs: list/search/prune reports, archive, promote, annotate

**New Tools:**
- list_indicators: List custom indicators in MQL5/Indicators
- list_scripts: List scripts in MQL5/Scripts

**Config Updates:**
- Added indicators_dir and scripts_dir to Config model
- Auto-discovery for MQL5/Indicators and MQL5/Scripts paths
- Updated healthcheck to validate new directories

**Benefits:**
- Single Responsibility Principle: each module handles one domain
- Easier maintenance and testing
- Clear separation of concerns
- Reduced cognitive load when modifying handlers
This commit is contained in:
Devid HW
2026-04-18 18:38:28 +07:00
parent 7959cb5c68
commit d8646074fb
11 changed files with 1984 additions and 1538 deletions
+29
View File
@@ -11,6 +11,8 @@ pub fn get_tools_list() -> Value {
tool_verify_setup(),
tool_list_symbols(),
tool_list_experts(),
tool_list_indicators(),
tool_list_scripts(),
tool_get_backtest_status(),
tool_get_optimization_status(),
tool_prune_reports(),
@@ -187,6 +189,33 @@ fn tool_list_experts() -> Value {
})
}
fn tool_list_indicators() -> Value {
json!({
"name": "list_indicators",
"description": "List all custom indicators in MQL5/Indicators",
"inputSchema": {
"type": "object",
"properties": {
"filter": { "type": "string", "description": "Optional name filter pattern" },
"include_builtin": { "type": "boolean", "description": "Include built-in MT5 indicators", "default": false }
}
}
})
}
fn tool_list_scripts() -> Value {
json!({
"name": "list_scripts",
"description": "List all scripts in MQL5/Scripts",
"inputSchema": {
"type": "object",
"properties": {
"filter": { "type": "string", "description": "Optional name filter pattern" }
}
}
})
}
fn tool_get_backtest_status() -> Value {
json!({
"name": "get_backtest_status",