(
&self,
Parameters(FormatCodeParams { file_path }): Parameters<FormatCodeParams>,
)
| 215 | |
| 216 | #[tool(description = "Apply rustfmt formatting to a file")] |
| 217 | async fn format_code( |
| 218 | &self, |
| 219 | Parameters(FormatCodeParams { file_path }): Parameters<FormatCodeParams>, |
| 220 | ) -> Result<CallToolResult, McpError> { |
| 221 | let args = serde_json::json!({ |
| 222 | "file_path": file_path |
| 223 | }); |
| 224 | |
| 225 | let mut analyzer = self.analyzer.lock().await; |
| 226 | match execute_tool("format_code", args, &mut analyzer).await { |
| 227 | Ok(result) => { |
| 228 | if let Some(content) = result.content.first() { |
| 229 | if let Some(text) = content.get("text") { |
| 230 | return Ok(CallToolResult::success(vec![Content::text( |
| 231 | text.as_str().unwrap_or("No result"), |
| 232 | )])); |
| 233 | } |
| 234 | } |
| 235 | Ok(CallToolResult::success(vec![Content::text( |
| 236 | "Format operation completed", |
| 237 | )])) |
| 238 | } |
| 239 | Err(e) => Ok(CallToolResult::success(vec![Content::text(format!( |
| 240 | "Error: {e}" |
| 241 | ))])), |
| 242 | } |
| 243 | } |
| 244 | |
| 245 | #[tool(description = "Parse and analyze Cargo.toml file")] |
| 246 | async fn analyze_manifest( |
nothing calls this directly
no test coverage detected