(
&self,
Parameters(ExtractFunctionParams {
file_path,
start_line,
start_character,
end_line,
end_character,
fun
| 302 | |
| 303 | #[tool(description = "Extract selected code into a new function")] |
| 304 | async fn extract_function( |
| 305 | &self, |
| 306 | Parameters(ExtractFunctionParams { |
| 307 | file_path, |
| 308 | start_line, |
| 309 | start_character, |
| 310 | end_line, |
| 311 | end_character, |
| 312 | function_name, |
| 313 | }): Parameters<ExtractFunctionParams>, |
| 314 | ) -> Result<CallToolResult, McpError> { |
| 315 | let args = serde_json::json!({ |
| 316 | "file_path": file_path, |
| 317 | "start_line": start_line, |
| 318 | "start_character": start_character, |
| 319 | "end_line": end_line, |
| 320 | "end_character": end_character, |
| 321 | "function_name": function_name |
| 322 | }); |
| 323 | |
| 324 | let mut analyzer = self.analyzer.lock().await; |
| 325 | match execute_tool("extract_function", args, &mut analyzer).await { |
| 326 | Ok(result) => { |
| 327 | if let Some(content) = result.content.first() { |
| 328 | if let Some(text) = content.get("text") { |
| 329 | return Ok(CallToolResult::success(vec![Content::text( |
| 330 | text.as_str().unwrap_or("No result"), |
| 331 | )])); |
| 332 | } |
| 333 | } |
| 334 | Ok(CallToolResult::success(vec![Content::text( |
| 335 | "Function extracted successfully", |
| 336 | )])) |
| 337 | } |
| 338 | Err(e) => Ok(CallToolResult::success(vec![Content::text(format!( |
| 339 | "Error: {e}" |
| 340 | ))])), |
| 341 | } |
| 342 | } |
| 343 | |
| 344 | #[tool(description = "Generate a struct with specified fields and derives")] |
| 345 | async fn generate_struct( |
nothing calls this directly
no test coverage detected