pub struct MockFailingTool { /* private fields */ }Available on crate feature
test-utils only.Expand description
A tool that always fails with a configured ToolErrorKind. Used to exercise structured
tool-failure surfacing (timeout, not-found, rate-limited, …) without a live
provider. Registered under the name flaky_tool.
Implementations§
Source§impl MockFailingTool
impl MockFailingTool
Sourcepub fn new(kind: ToolErrorKind) -> Self
pub fn new(kind: ToolErrorKind) -> Self
A tool that fails with the given classification every call.
Trait Implementations§
Source§impl Clone for MockFailingTool
impl Clone for MockFailingTool
Source§impl Tool for MockFailingTool
impl Tool for MockFailingTool
Source§type Error = MockFailure
type Error = MockFailure
Typed error returned by direct calls to this tool. Read more
Source§fn description(&self) -> String
fn description(&self) -> String
Model-facing description: what the tool does and when to pick it
over another, such as “Use it rather than
wc in shell”. The
model reads it with the tool’s parameters.Source§fn parameters(&self) -> Value
fn parameters(&self) -> Value
JSON Schema for arguments.
Source§async fn call(
&self,
_context: &mut ToolContext,
_args: Self::Args,
) -> Result<Self::Output, Self::Error>
async fn call( &self, _context: &mut ToolContext, _args: Self::Args, ) -> Result<Self::Output, Self::Error>
Execute the tool.
Source§fn map_error(&self, error: Self::Error) -> ToolExecutionError
fn map_error(&self, error: Self::Error) -> ToolExecutionError
Normalize a typed author-facing error for runtime policy and telemetry. Read more
Source§fn annotations(&self) -> ToolAnnotations
fn annotations(&self) -> ToolAnnotations
What calling the tool does to the world, for the host’s policies
(approval, plan mode, which calls run side by side). Nothing is
stated by default, which reads as the protocol’s defaults
(
ToolAnnotations).Auto Trait Implementations§
impl Forget for MockFailingTool
impl Freeze for MockFailingTool
impl Move for MockFailingTool
impl RefUnwindSafe for MockFailingTool
impl Send for MockFailingTool
impl Sync for MockFailingTool
impl Unpin for MockFailingTool
impl UnsafeUnpin for MockFailingTool
impl UnwindSafe for MockFailingTool
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