pub enum ToolError {
NotFound(ToolName),
InvalidInput(String),
PermissionDenied(PermissionDenial),
ExecutionFailed(String),
AuthRequired(Box<AuthRequest>),
Unavailable(String),
Cancelled,
Internal(String),
}Expand description
Errors that can occur during tool lookup, permission checking, or execution.
Returned from Tool::invoke and also used internally by
BasicToolExecutor to represent lookup and permission failures.
Variants§
NotFound(ToolName)
No tool with the given name exists in the registry.
InvalidInput(String)
The input JSON did not match the tool’s expected schema.
PermissionDenied(PermissionDenial)
A permission policy denied the operation.
ExecutionFailed(String)
The tool ran but encountered a runtime error.
AuthRequired(Box<AuthRequest>)
The tool needs authentication credentials to proceed.
The executor converts this into ToolInterruption::AuthRequired.
The tool is temporarily unavailable.
Cancelled
The turn was cancelled while the tool was running.
Internal(String)
An unexpected internal error.
Implementations§
Source§impl ToolError
impl ToolError
Sourcepub fn permission_denied(denial: PermissionDenial) -> Self
pub fn permission_denied(denial: PermissionDenial) -> Self
Convenience constructor for the PermissionDenied variant.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ToolError
impl<'de> Deserialize<'de> for ToolError
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Error for ToolError
impl Error for ToolError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl From<PermissionDenial> for ToolError
impl From<PermissionDenial> for ToolError
Source§fn from(value: PermissionDenial) -> Self
fn from(value: PermissionDenial) -> Self
Converts to this type from the input type.
impl StructuralPartialEq for ToolError
Auto Trait Implementations§
impl Freeze for ToolError
impl RefUnwindSafe for ToolError
impl Send for ToolError
impl Sync for ToolError
impl Unpin for ToolError
impl UnsafeUnpin for ToolError
impl UnwindSafe for ToolError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more