Reorganize tool definitions into granular domain modules

**New structure:**
src/tools/definitions/
├── mod.rs         # Aggregates all 43 tools
├── system.rs      # 3 tools: healthcheck, verify_setup, list_symbols
├── experts.rs     # 4 tools: compile_ea, list_experts, list_indicators, list_scripts
├── backtest.rs    # 4 tools: run_backtest, get_backtest_status, cache_status, clean_cache
├── optimization.rs # 4 tools: run_optimization, get_optimization_status, get_optimization_results, list_jobs
├── analytics.rs   # 9 tools: analyze_report + 8 granular analytics
├── reports.rs     # 11 tools: list_reports, search_reports, get_latest_report, etc.
├── setfiles.rs    # 8 tools: read/write/patch/clone/diff set files
└── baseline.rs    # 1 tool: compare_baseline

**Benefits:**
- Domain-based organization (21KB monolith -> 9 focused files)
- Each domain can evolve independently
- Easier to find and modify tool definitions
- Clear separation between system, experts, backtest, optimization, analytics, reports, setfiles
This commit is contained in:
Devid HW
2026-04-19 02:25:25 +07:00
parent 1f63505cb9
commit bc5d0d7022
10 changed files with 703 additions and 693 deletions
+67
View File
@@ -0,0 +1,67 @@
use serde_json::{json, Value};
pub fn tool_run_backtest() -> Value {
json!({
"name": "run_backtest",
"description": "Run a complete MT5 backtest pipeline: compile → clean cache → backtest → extract → analyze",
"inputSchema": {
"type": "object",
"required": ["expert"],
"properties": {
"expert": { "type": "string", "description": "EA name without path or extension" },
"symbol": { "type": "string", "description": "Trading symbol" },
"from_date": { "type": "string", "description": "Start date YYYY.MM.DD" },
"to_date": { "type": "string", "description": "End date YYYY.MM.DD" },
"timeframe": { "type": "string", "enum": ["M1", "M5", "M15", "M30", "H1", "H4", "D1"] },
"deposit": { "type": "integer" },
"model": { "type": "integer", "enum": [0, 1, 2] },
"set_file": { "type": "string", "description": "Path to .set parameter file" },
"skip_compile": { "type": "boolean" },
"skip_clean": { "type": "boolean" },
"skip_analyze": { "type": "boolean" },
"deep": { "type": "boolean", "description": "Run deep analysis" },
"shutdown": { "type": "boolean", "description": "Close MT5 after backtest" },
"kill_existing": { "type": "boolean" },
"timeout": { "type": "integer" },
"gui": { "type": "boolean" }
}
}
})
}
pub fn tool_get_backtest_status() -> Value {
json!({
"name": "get_backtest_status",
"description": "Check progress of a running backtest pipeline",
"inputSchema": {
"type": "object",
"properties": {
"report_dir": { "type": "string" }
}
}
})
}
pub fn tool_cache_status() -> Value {
json!({
"name": "cache_status",
"description": "Check tester cache disk usage",
"inputSchema": {
"type": "object"
}
})
}
pub fn tool_clean_cache() -> Value {
json!({
"name": "clean_cache",
"description": "Delete old tester cache files",
"inputSchema": {
"type": "object",
"properties": {
"symbol": { "type": "string" },
"dry_run": { "type": "boolean" }
}
}
})
}