Add nvim_get_server_info diagnostic tool
This commit is contained in:
1 parent
d60d6ca70b
commit
80b1969b15
1 file changed
+20
@@ -1024,6 +1024,14 @@ pub async fn run_mcp_loop(app_name: &str, app_version: &str) {
|
||||
},
|
||||
"required": ["file", "pattern"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "nvim_get_server_info",
|
||||
"description": "Get diagnostic info about this MCP server (OS, version, executable path, backend)",
|
||||
"inputSchema": {
|
||||
"type": "object",
|
||||
"properties": {}
|
||||
}
|
||||
}
|
||||
]
|
||||
})),
|
||||
@@ -1477,6 +1485,18 @@ pub async fn run_mcp_loop(app_name: &str, app_version: &str) {
|
||||
send_error(id, -32602, "Missing 'code'").await;
|
||||
}
|
||||
}
|
||||
"nvim_get_server_info" => {
|
||||
let os = if cfg!(windows) { "Windows" } else { "Linux" };
|
||||
let exe_path = std::env::current_exe()
|
||||
.map(|p| p.to_string_lossy().to_string())
|
||||
.unwrap_or_else(|_| "unknown".to_string());
|
||||
let socket = get_socket_path().await.unwrap_or_else(|e| format!("Error: {}", e));
|
||||
let info = format!(
|
||||
"Server: {}\nVersion: {}\nOS: {}\nExecutable: {}\nBackend Socket: {}",
|
||||
app_name, app_version, os, exe_path, socket
|
||||
);
|
||||
send_text_result!(id, info);
|
||||
}
|
||||
_ => send_error(id, -32601, "Method not found").await,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user