feat: add check_update and update tools with background auto-check
On the first tool call of each session, a background task fires once and fetches the latest release tag from the GitHub API (5 s timeout). The result is cached in a static OnceLock for the lifetime of the process — no repeated network calls. check_update: returns cached result instantly, or fetches on demand if the background task hasn't completed yet. update: downloads the latest tarball for the current platform, extracts the binary, and atomically replaces the running executable via a temp-file rename. Requires MCP reconnect to activate new version. Platform support: macos-aarch64, macos-x86_64, linux-x86_64. Unsupported platforms return a build-from-source hint. Tool count: 87 → 89. README and MCP_TOOLS.md updated. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
a1c5d328b3
commit
e58316e70e
@@ -63,6 +63,8 @@ pub fn get_tools_list() -> Value {
|
||||
system::tool_list_symbols(),
|
||||
system::tool_healthcheck(),
|
||||
system::tool_get_active_account(),
|
||||
system::tool_check_update(),
|
||||
system::tool_update(),
|
||||
// Utility (8 tools)
|
||||
utility::tool_check_symbol_data_status(),
|
||||
utility::tool_get_backtest_history(),
|
||||
|
||||
@@ -45,3 +45,25 @@ pub fn tool_get_active_account() -> Value {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
pub fn tool_check_update() -> Value {
|
||||
json!({
|
||||
"name": "check_update",
|
||||
"description": "Check if a newer version of mt5-quant is available on GitHub. A background check runs automatically on the first tool call of each session; this tool returns that cached result instantly or fetches it on demand.",
|
||||
"inputSchema": {
|
||||
"type": "object",
|
||||
"properties": {}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
pub fn tool_update() -> Value {
|
||||
json!({
|
||||
"name": "update",
|
||||
"description": "Download and install the latest mt5-quant binary from GitHub Releases, then replace the current executable in place. Restart the MCP connection after updating to load the new version.",
|
||||
"inputSchema": {
|
||||
"type": "object",
|
||||
"properties": {}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user