pub struct ToolError {
pub code: &'static str,
pub message: String,
pub errors: Vec<String>,
pub hint: Option<String>,
}Expand description
A domain failure surfaced to the agent as an MCP tool error (never a
JSON-RPC error): {code, message, errors?, hint?}.
Fields§
§code: &'static str§message: String§errors: Vec<String>§hint: Option<String>Implementations§
Source§impl ToolError
impl ToolError
fn new(code: &'static str, message: impl Into<String>) -> Self
fn with_hint(self, hint: impl Into<String>) -> Self
pub fn not_found(what: &str, name: &str) -> Self
pub fn invalid_input(msg: impl Into<String>) -> Self
pub fn invalid_config(errors: Vec<String>) -> Self
pub fn debug_disabled() -> Self
pub fn sandbox_disabled() -> Self
pub fn forbidden(have: McpScope) -> Self
Sourcepub fn invalid_payload(msg: impl Into<String>) -> Self
pub fn invalid_payload(msg: impl Into<String>) -> Self
A definition that did not parse (validate_/put_): the hint spells out the argument shape every write tool shares.
Sourcepub fn sandbox_bad_request(msg: impl Into<String>) -> Self
pub fn sandbox_bad_request(msg: impl Into<String>) -> Self
A malformed run_sandbox payload: the message says what failed, the
hint shows the accepted shape so the caller can fix it in one step.
Sourcepub fn unsaved_changes(pending: Vec<String>) -> Self
pub fn unsaved_changes(pending: Vec<String>) -> Self
reload_config would revert live edits that were never written to
gateway.yaml; errors lists them.
pub fn store_error(msg: impl Into<String>) -> Self
pub fn unknown_tool(name: &str) -> Self
pub fn internal(msg: impl Into<String>) -> Self
Trait Implementations§
impl Eq for ToolError
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§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§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>
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>
Converts
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>
Converts
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