Validate tool call parameters
(&self, tool_call: &LlmToolCall)
| 524 | |
| 525 | /// Validate tool call parameters |
| 526 | fn validate_tool_call(&self, tool_call: &LlmToolCall) -> Result<(), ToolExecutionError> { |
| 527 | if tool_call.name.trim().is_empty() { |
| 528 | return Err(ToolExecutionError::ValidationError( |
| 529 | "Tool name cannot be empty".to_string(), |
| 530 | )); |
| 531 | } |
| 532 | |
| 533 | if tool_call.id.trim().is_empty() { |
| 534 | return Err(ToolExecutionError::ValidationError( |
| 535 | "Tool call ID cannot be empty".to_string(), |
| 536 | )); |
| 537 | } |
| 538 | |
| 539 | // Validate parameters is a valid JSON object |
| 540 | if !tool_call.parameters.is_object() && !tool_call.parameters.is_null() { |
| 541 | return Err(ToolExecutionError::ValidationError( |
| 542 | "Tool parameters must be a JSON object or null".to_string(), |
| 543 | )); |
| 544 | } |
| 545 | |
| 546 | Ok(()) |
| 547 | } |
| 548 | |
| 549 | /// Check if execution should be stopped due to limits |
| 550 | fn check_execution_limits( |
no test coverage detected