feat: add get_version MCP tool returning version and build hash

Agents can now call get_version to see what server version and commit
they're running against.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
dave
2026-04-13 13:50:37 +00:00
parent 05655847d8
commit ed2526ce41
2 changed files with 22 additions and 1 deletions
+11
View File
@@ -319,6 +319,17 @@ pub(super) fn tool_dump_crdt(args: &Value) -> Result<String, String> {
.map_err(|e| format!("Serialization error: {e}"))
}
/// MCP tool: return the server version and build hash.
pub(super) fn tool_get_version() -> Result<String, String> {
let build_hash = std::fs::read_to_string(".huskies/build_hash")
.unwrap_or_else(|_| "unknown".to_string());
serde_json::to_string_pretty(&json!({
"version": env!("CARGO_PKG_VERSION"),
"build_hash": build_hash.trim(),
}))
.map_err(|e| format!("Serialization error: {e}"))
}
/// MCP tool: count lines in a specific file relative to the project root.
pub(super) fn tool_loc_file(args: &Value, ctx: &AppContext) -> Result<String, String> {
let file_path = args