(
args: Value,
analyzer: &mut RustAnalyzerClient,
)
| 4 | use serde_json::{Value, json}; |
| 5 | |
| 6 | pub async fn format_code_impl( |
| 7 | args: Value, |
| 8 | analyzer: &mut RustAnalyzerClient, |
| 9 | ) -> Result<ToolResult> { |
| 10 | let file_path = args |
| 11 | .get("file_path") |
| 12 | .and_then(|v| v.as_str()) |
| 13 | .ok_or_else(|| anyhow::anyhow!("Missing file_path parameter"))?; |
| 14 | |
| 15 | // Implementation will use rust-analyzer LSP to format code |
| 16 | let result = analyzer.format_code(file_path).await?; |
| 17 | |
| 18 | Ok(ToolResult { |
| 19 | content: vec![ |
| 20 | json!({ |
| 21 | "type": "text", |
| 22 | "text": result |
| 23 | }) |
| 24 | .as_object() |
| 25 | .unwrap() |
| 26 | .clone(), |
| 27 | ], |
| 28 | }) |
| 29 | } |
no test coverage detected