pub struct ToolResult { /* private fields */ }Expand description
Successful terminal tool result.
Implementations§
Source§impl ToolResult
impl ToolResult
Sourcepub fn new(
content: Vec<ContentBlock>,
output: Value,
) -> Result<Self, ToolResultError>
pub fn new( content: Vec<ContentBlock>, output: Value, ) -> Result<Self, ToolResultError>
Creates a result with model-visible content and machine output.
§Errors
Returns an error for empty/invalid content or non-object output.
Sourcepub fn with_details(self, details: ProtocolMetadata) -> Self
pub fn with_details(self, details: ProtocolMetadata) -> Self
Adds safe details.
Sourcepub fn with_presentation(self, presentation: ToolPresentation) -> Self
pub fn with_presentation(self, presentation: ToolPresentation) -> Self
Adds a bounded durable UI presentation kept out of model-visible content.
Sourcepub fn with_usage(self, usage: Usage) -> Self
pub fn with_usage(self, usage: Usage) -> Self
Adds tool-specific usage.
Sourcepub fn content(&self) -> &[ContentBlock]
pub fn content(&self) -> &[ContentBlock]
Returns model-visible content.
Sourcepub const fn details(&self) -> &ProtocolMetadata
pub const fn details(&self) -> &ProtocolMetadata
Returns safe details.
Sourcepub const fn presentation(&self) -> Option<&ToolPresentation>
pub const fn presentation(&self) -> Option<&ToolPresentation>
Returns the optional durable UI presentation.
Trait Implementations§
Source§impl Clone for ToolResult
impl Clone for ToolResult
Source§fn clone(&self) -> ToolResult
fn clone(&self) -> ToolResult
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ToolResult
impl Debug for ToolResult
Source§impl PartialEq for ToolResult
impl PartialEq for ToolResult
impl StructuralPartialEq for ToolResult
Auto Trait Implementations§
impl Freeze for ToolResult
impl RefUnwindSafe for ToolResult
impl Send for ToolResult
impl Sync for ToolResult
impl Unpin for ToolResult
impl UnsafeUnpin for ToolResult
impl UnwindSafe for ToolResult
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