(
&self,
Parameters(GenerateTraitImplParams {
trait_name,
struct_name,
file_path,
}): Parameters<GenerateTraitImplParams>,
)
| 417 | |
| 418 | #[tool(description = "Generate a trait implementation for a struct")] |
| 419 | async fn generate_trait_impl( |
| 420 | &self, |
| 421 | Parameters(GenerateTraitImplParams { |
| 422 | trait_name, |
| 423 | struct_name, |
| 424 | file_path, |
| 425 | }): Parameters<GenerateTraitImplParams>, |
| 426 | ) -> Result<CallToolResult, McpError> { |
| 427 | let args = serde_json::json!({ |
| 428 | "trait_name": trait_name, |
| 429 | "struct_name": struct_name, |
| 430 | "file_path": file_path |
| 431 | }); |
| 432 | |
| 433 | let mut analyzer = self.analyzer.lock().await; |
| 434 | match execute_tool("generate_trait_impl", args, &mut analyzer).await { |
| 435 | Ok(result) => { |
| 436 | if let Some(content) = result.content.first() { |
| 437 | if let Some(text) = content.get("text") { |
| 438 | return Ok(CallToolResult::success(vec![Content::text( |
| 439 | text.as_str().unwrap_or("No result"), |
| 440 | )])); |
| 441 | } |
| 442 | } |
| 443 | Ok(CallToolResult::success(vec![Content::text( |
| 444 | "Trait implementation generated successfully", |
| 445 | )])) |
| 446 | } |
| 447 | Err(e) => Ok(CallToolResult::success(vec![Content::text(format!( |
| 448 | "Error: {e}" |
| 449 | ))])), |
| 450 | } |
| 451 | } |
| 452 | |
| 453 | #[tool(description = "Generate unit tests for a function")] |
| 454 | async fn generate_tests( |
nothing calls this directly
no test coverage detected