pub enum BeforeToolCallResult {
Continue(Value),
ShortCircuit(Value),
}Available on crate feature
plugin only.Expand description
Result from a before_tool_call hook invocation.
Determines whether tool execution continues with (possibly modified) arguments, or is short-circuited with a synthetic result.
§Examples
§Continuing with modified arguments
use adk_plugin::BeforeToolCallResult;
use serde_json::json;
// Pass through arguments unchanged
let args = json!({"query": "hello"});
let result = BeforeToolCallResult::Continue(args);
// Or modify arguments before passing to the tool
let sanitized = json!({"query": "hello", "safe_mode": true});
let result = BeforeToolCallResult::Continue(sanitized);§Short-circuiting tool execution
use adk_plugin::BeforeToolCallResult;
use serde_json::json;
// Skip tool execution and return a cached result
let cached = json!({"data": "cached response"});
let result = BeforeToolCallResult::ShortCircuit(cached);Variants§
Continue(Value)
Continue execution with (possibly modified) arguments.
The contained value will be passed to the next plugin in the chain, and ultimately to the tool execution if this is the last plugin.
ShortCircuit(Value)
Short-circuit: skip tool execution and use this synthetic result.
When returned, no further plugins in the chain are invoked, the tool is not executed, and this value is used as the tool output.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BeforeToolCallResult
impl RefUnwindSafe for BeforeToolCallResult
impl Send for BeforeToolCallResult
impl Sync for BeforeToolCallResult
impl Unpin for BeforeToolCallResult
impl UnsafeUnpin for BeforeToolCallResult
impl UnwindSafe for BeforeToolCallResult
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