Add 10 new debugging and diagnostic tools for Wine and MT5

This commit is contained in:
Devid HW
2026-04-22 12:24:43 +07:00
parent b97011d5b6
commit e1adcad45c
14 changed files with 745 additions and 238 deletions
+43 -29
View File
@@ -1,5 +1,8 @@
use serde_json::{json, Value};
// Common description suffix for all analytics tools
const REPORT_HINT: &str = "report_id (preferred), report_dir (legacy path), or omit for latest report.";
pub fn tool_analyze_report() -> Value {
json!({
"name": "analyze_report",
@@ -7,7 +10,8 @@ pub fn tool_analyze_report() -> Value {
"inputSchema": {
"type": "object",
"properties": {
"report_dir": { "type": "string", "description": "Path to report directory containing deals.csv" },
"report_id": { "type": "string", "description": REPORT_HINT },
"report_dir": { "type": "string", "description": "Legacy: path to report directory (use report_id instead)" },
"analytics": {
"type": "array",
"description": "Optional: specific analytics to run. If omitted, runs all.",
@@ -29,7 +33,8 @@ pub fn tool_analyze_monthly_pnl() -> Value {
"inputSchema": {
"type": "object",
"properties": {
"report_dir": { "type": "string", "description": "Path to report directory containing deals.csv" }
"report_id": { "type": "string", "description": REPORT_HINT },
"report_dir": { "type": "string", "description": "Legacy: path to report directory" }
}
}
})
@@ -42,7 +47,8 @@ pub fn tool_analyze_drawdown_events() -> Value {
"inputSchema": {
"type": "object",
"properties": {
"report_dir": { "type": "string" }
"report_id": { "type": "string", "description": REPORT_HINT },
"report_dir": { "type": "string", "description": "Legacy: path to report directory" }
}
}
})
@@ -55,7 +61,8 @@ pub fn tool_analyze_top_losses() -> Value {
"inputSchema": {
"type": "object",
"properties": {
"report_dir": { "type": "string" },
"report_id": { "type": "string", "description": REPORT_HINT },
"report_dir": { "type": "string", "description": "Legacy: path to report directory" },
"limit": { "type": "integer", "description": "Number of losses to return (default: 10)", "default": 10 }
}
}
@@ -69,7 +76,8 @@ pub fn tool_analyze_loss_sequences() -> Value {
"inputSchema": {
"type": "object",
"properties": {
"report_dir": { "type": "string" }
"report_id": { "type": "string", "description": REPORT_HINT },
"report_dir": { "type": "string", "description": "Legacy: path to report directory" }
}
}
})
@@ -82,7 +90,8 @@ pub fn tool_analyze_position_pairs() -> Value {
"inputSchema": {
"type": "object",
"properties": {
"report_dir": { "type": "string" }
"report_id": { "type": "string", "description": REPORT_HINT },
"report_dir": { "type": "string", "description": "Legacy: path to report directory" }
}
}
})
@@ -95,7 +104,8 @@ pub fn tool_analyze_direction_bias() -> Value {
"inputSchema": {
"type": "object",
"properties": {
"report_dir": { "type": "string" }
"report_id": { "type": "string", "description": REPORT_HINT },
"report_dir": { "type": "string", "description": "Legacy: path to report directory" }
}
}
})
@@ -108,7 +118,8 @@ pub fn tool_analyze_streaks() -> Value {
"inputSchema": {
"type": "object",
"properties": {
"report_dir": { "type": "string" }
"report_id": { "type": "string", "description": REPORT_HINT },
"report_dir": { "type": "string", "description": "Legacy: path to report directory" }
}
}
})
@@ -121,7 +132,8 @@ pub fn tool_analyze_concurrent_peak() -> Value {
"inputSchema": {
"type": "object",
"properties": {
"report_dir": { "type": "string" }
"report_id": { "type": "string", "description": REPORT_HINT },
"report_dir": { "type": "string", "description": "Legacy: path to report directory" }
}
}
})
@@ -133,9 +145,9 @@ pub fn tool_list_deals() -> Value {
"description": "List individual deals from a backtest report with optional filters",
"inputSchema": {
"type": "object",
"required": ["report_dir"],
"properties": {
"report_dir": { "type": "string", "description": "Path to report directory containing deals.csv" },
"report_id": { "type": "string", "description": REPORT_HINT },
"report_dir": { "type": "string", "description": "Legacy: path to report directory" },
"deal_type": { "type": "string", "enum": ["buy", "sell"], "description": "Filter by deal type" },
"min_profit": { "type": "number", "description": "Minimum profit (use negative for losses)" },
"max_profit": { "type": "number", "description": "Maximum profit" },
@@ -155,9 +167,10 @@ pub fn tool_search_deals_by_comment() -> Value {
"description": "Search deals by comment text (case-insensitive partial match)",
"inputSchema": {
"type": "object",
"required": ["report_dir", "query"],
"required": ["query"],
"properties": {
"report_dir": { "type": "string" },
"report_id": { "type": "string", "description": REPORT_HINT },
"report_dir": { "type": "string", "description": "Legacy: path to report directory" },
"query": { "type": "string", "description": "Search text in comments" },
"limit": { "type": "integer", "default": 50 }
}
@@ -171,9 +184,10 @@ pub fn tool_search_deals_by_magic() -> Value {
"description": "Filter deals by magic number (EA identifier)",
"inputSchema": {
"type": "object",
"required": ["report_dir", "magic"],
"required": ["magic"],
"properties": {
"report_dir": { "type": "string" },
"report_id": { "type": "string", "description": REPORT_HINT },
"report_dir": { "type": "string", "description": "Legacy: path to report directory" },
"magic": { "type": "string", "description": "Magic number to filter by" },
"limit": { "type": "integer", "default": 100 }
}
@@ -187,9 +201,9 @@ pub fn tool_analyze_profit_distribution() -> Value {
"description": "Analyze profit distribution - small/medium/large wins and losses with detailed buckets",
"inputSchema": {
"type": "object",
"required": ["report_dir"],
"properties": {
"report_dir": { "type": "string" }
"report_id": { "type": "string", "description": REPORT_HINT },
"report_dir": { "type": "string", "description": "Legacy: path to report directory" }
}
}
})
@@ -201,9 +215,9 @@ pub fn tool_analyze_time_performance() -> Value {
"description": "Analyze performance by hour of day and day of week",
"inputSchema": {
"type": "object",
"required": ["report_dir"],
"properties": {
"report_dir": { "type": "string" }
"report_id": { "type": "string", "description": REPORT_HINT },
"report_dir": { "type": "string", "description": "Legacy: path to report directory" }
}
}
})
@@ -215,9 +229,9 @@ pub fn tool_analyze_hold_time_distribution() -> Value {
"description": "Analyze hold time distribution and correlation with profit",
"inputSchema": {
"type": "object",
"required": ["report_dir"],
"properties": {
"report_dir": { "type": "string" }
"report_id": { "type": "string", "description": REPORT_HINT },
"report_dir": { "type": "string", "description": "Legacy: path to report directory" }
}
}
})
@@ -229,9 +243,9 @@ pub fn tool_analyze_layer_performance() -> Value {
"description": "Analyze performance by grid layer (extracted from deal comments)",
"inputSchema": {
"type": "object",
"required": ["report_dir"],
"properties": {
"report_dir": { "type": "string" }
"report_id": { "type": "string", "description": REPORT_HINT },
"report_dir": { "type": "string", "description": "Legacy: path to report directory" }
}
}
})
@@ -243,9 +257,9 @@ pub fn tool_analyze_volume_vs_profit() -> Value {
"description": "Analyze correlation between volume and profit, plus performance by volume bucket",
"inputSchema": {
"type": "object",
"required": ["report_dir"],
"properties": {
"report_dir": { "type": "string" }
"report_id": { "type": "string", "description": REPORT_HINT },
"report_dir": { "type": "string", "description": "Legacy: path to report directory" }
}
}
})
@@ -257,9 +271,9 @@ pub fn tool_analyze_costs() -> Value {
"description": "Analyze commission and swap costs impact on profitability",
"inputSchema": {
"type": "object",
"required": ["report_dir"],
"properties": {
"report_dir": { "type": "string" }
"report_id": { "type": "string", "description": REPORT_HINT },
"report_dir": { "type": "string", "description": "Legacy: path to report directory" }
}
}
})
@@ -271,9 +285,9 @@ pub fn tool_analyze_efficiency() -> Value {
"description": "Calculate efficiency metrics: profit per hour/day, annualized return, trade frequency",
"inputSchema": {
"type": "object",
"required": ["report_dir"],
"properties": {
"report_dir": { "type": "string" }
"report_id": { "type": "string", "description": REPORT_HINT },
"report_dir": { "type": "string", "description": "Legacy: path to report directory" }
}
}
})