(
request: ToolValidationRequest,
)
| 301 | |
| 302 | #[tauri::command] |
| 303 | pub async fn validate_tool_input( |
| 304 | request: ToolValidationRequest, |
| 305 | ) -> Result<ToolValidationResponse, String> { |
| 306 | let tools = get_all_tools().await; |
| 307 | |
| 308 | for tool in tools { |
| 309 | if tool.name() == request.tool_name { |
| 310 | ensure_workspace_requirement( |
| 311 | &request.tool_name, |
| 312 | &request.input, |
| 313 | request.workspace_path.as_deref(), |
| 314 | )?; |
| 315 | |
| 316 | let context = build_tool_context(request.workspace_path.as_deref()).await; |
| 317 | |
| 318 | let validation_result = tool.validate_input(&request.input, Some(&context)).await; |
| 319 | |
| 320 | return Ok(ToolValidationResponse { |
| 321 | tool_name: request.tool_name, |
| 322 | valid: validation_result.result, |
| 323 | message: validation_result.message, |
| 324 | error_code: validation_result.error_code, |
| 325 | meta: validation_result.meta, |
| 326 | }); |
| 327 | } |
| 328 | } |
| 329 | |
| 330 | Err(format!("Tool '{}' not found", request.tool_name)) |
| 331 | } |
| 332 | |
| 333 | #[tauri::command] |
| 334 | pub async fn execute_tool(request: ToolExecutionRequest) -> Result<ToolExecutionResponse, String> { |
nothing calls this directly
no test coverage detected