pub enum ToolError {
Edit(EditError),
Skill(SkillRefusal),
InvalidArguments {
message: String,
},
NotFound {
message: String,
},
Forbidden {
message: String,
},
Retryable {
message: String,
retry_after_seconds: u64,
},
StagedStateChanged {
message: String,
entities: Vec<Value>,
},
Refused {
code: ToolErrorCode,
message: String,
details: Map<String, Value>,
},
InsufficientScope {
required: McpScope,
},
Internal(String),
}Expand description
Why a tool call failed. Mapped to a tool result or a JSON-RPC error by the protocol layer.
Variants§
Edit(EditError)
An edit the engines rejected; shown to the agent with its fix.
Skill(SkillRefusal)
InvalidArguments
NotFound
Forbidden
The user’s role doesn’t allow this on that course or page.
Retryable
A dependency (validator, storage) is down or busy; the same call can be retried.
StagedStateChanged
Another call changed the staged state this call read, so nothing was staged; the call can be repeated after reading again.
Fields
Refused
The call changed nothing because it would break a rule of publishing or reverting; code
names the rule and details what to fix.
InsufficientScope
The token lacks a scope; answered with an HTTP 403 so the client can step up.
Internal(String)
Implementations§
Source§impl ToolError
impl ToolError
Sourcepub fn no_edit_rights() -> Self
pub fn no_edit_rights() -> Self
The user’s roles don’t allow editing the course.
Sourcepub fn retryable(message: impl Into<String>, retry_after_seconds: u64) -> Self
pub fn retryable(message: impl Into<String>, retry_after_seconds: u64) -> Self
A dependency is down or busy; the agent may repeat the same call after
retry_after_seconds.
Sourcepub fn forbidden_or_internal(
error: AuthorizationError,
message: impl Into<String>,
) -> Self
pub fn forbidden_or_internal( error: AuthorizationError, message: impl Into<String>, ) -> Self
A refusal with message when error is one; an internal error when the check couldn’t be
made.
Sourcepub fn refused(
code: ToolErrorCode,
message: impl Into<String>,
details: Value,
) -> Self
pub fn refused( code: ToolErrorCode, message: impl Into<String>, details: Value, ) -> Self
A ToolError::Refused with the fields of details, a JSON object.
Sourcepub fn into_json(self) -> Value
pub fn into_json(self) -> Value
The error object of the result the agent gets. Dispatch answers insufficient scopes and
internal errors with protocol errors instead.
Sourcepub fn into_result(self) -> ToolResult
pub fn into_result(self) -> ToolResult
The isError result the agent gets; see ToolError::into_json.
Trait Implementations§
Source§impl Error for ToolError
impl Error for ToolError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<ModelError> for ToolError
impl From<ModelError> for ToolError
Source§fn from(error: ModelError) -> Self
fn from(error: ModelError) -> Self
Source§impl From<SkillRefusal> for ToolError
impl From<SkillRefusal> for ToolError
Source§fn from(source: SkillRefusal) -> Self
fn from(source: SkillRefusal) -> Self
Source§impl From<ValidatorError> for ToolError
impl From<ValidatorError> for ToolError
Source§fn from(error: ValidatorError) -> Self
fn from(error: ValidatorError) -> Self
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
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<E> InstrumentError for Ewhere
TracedError<E>: From<E>,
impl<E> InstrumentError for Ewhere
TracedError<E>: From<E>,
§type Instrumented = TracedError<E>
type Instrumented = TracedError<E>
§fn in_current_span(self) -> <E as InstrumentError>::Instrumented
fn in_current_span(self) -> <E as InstrumentError>::Instrumented
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].