MCPcopy Create free account
hub / github.com/InfinitiBit/graphbit / validate_tool_call

Method validate_tool_call

python/src/tools/executor.rs:526–547  ·  view source on GitHub ↗

Validate tool call parameters

(&self, tool_call: &LlmToolCall)

Source from the content-addressed store, hash-verified

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(

Callers 1

execute_toolsMethod · 0.80

Calls 3

ValidationErrorClass · 0.85
to_stringMethod · 0.80
is_emptyMethod · 0.45

Tested by

no test coverage detected