#[non_exhaustive]pub struct ToolCallContext {
pub call_block_id: BlockId,
pub input: ToolCallPayload,
pub result_notes: Vec<TextPayload>,
/* private fields */
}Expand description
Identity of one tool dispatch, handed to Tool::execute.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.call_block_id: BlockIdThe declaration block whose result this dispatch produces.
input: ToolCallPayloadThe effective input after any pre-processing edits.
result_notes: Vec<TextPayload>Notes added before execution. ToolBatch::resolve_at prepends these
to the returned result’s notes; tool implementations should return
only notes they add and must not copy this field into the result.
Implementations§
Source§impl ToolCallContext
impl ToolCallContext
Sourcepub fn new(call_block_id: BlockId, input: ToolCallPayload) -> Self
pub fn new(call_block_id: BlockId, input: ToolCallPayload) -> Self
A call context with no result notes and no attachments.
Sourcepub fn from_declaration(
call_block_id: BlockId,
declaration: &ToolCallPayload,
) -> Self
pub fn from_declaration( call_block_id: BlockId, declaration: &ToolCallPayload, ) -> Self
Builds execution material from a committed declaration.
Sourcepub fn attachment<T: Any>(&self) -> Option<&T>
pub fn attachment<T: Any>(&self) -> Option<&T>
Borrows the call-scoped attachment of exact type T, if present.
Sourcepub fn attachments(&self) -> &CallAttachments
pub fn attachments(&self) -> &CallAttachments
Borrows the full call-scoped attachment bag.
Sourcepub fn with_attachment<T: Any + Send + Sync>(self, value: T) -> Self
pub fn with_attachment<T: Any + Send + Sync>(self, value: T) -> Self
Attaches a value of type T, replacing any prior attachment of the same
type. Useful for unit-testing Tool::execute directly without a
crate::ToolBatch.
Trait Implementations§
Source§impl Clone for ToolCallContext
impl Clone for ToolCallContext
Auto Trait Implementations§
impl !RefUnwindSafe for ToolCallContext
impl !UnwindSafe for ToolCallContext
impl Forget for ToolCallContext
impl Freeze for ToolCallContext
impl Move for ToolCallContext
impl Send for ToolCallContext
impl Sync for ToolCallContext
impl Unpin for ToolCallContext
impl UnsafeUnpin for ToolCallContext
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