pub struct ToolContext { /* private fields */ }Expand description
Per-call environment for ToolProvider::execute. Fields are sealed so
the runtime can add capabilities without breaking tool authors.
Implementations§
Source§impl ToolContext
impl ToolContext
pub fn session_id(&self) -> &str
pub async fn session_model(&self) -> Result<ToolSessionModel, PluginError>
pub async fn session_snapshot(&self) -> Result<SessionSnapshot, PluginError>
pub async fn snapshot_current_session( &self, ) -> Result<SessionSnapshot, PluginError>
pub async fn snapshot_session( &self, session_id: impl AsRef<str>, ) -> Result<SessionSnapshot, PluginError>
pub async fn tool_catalog(&self) -> Result<Vec<Value>, PluginError>
pub async fn set_tools_availability( &self, names: &[String], availability: Option<ToolAvailability>, ) -> Result<u64, PluginError>
pub fn sessions(&self) -> ToolSessionControl
pub fn tasks(&self) -> ToolTaskControl
pub async fn direct_completion( &self, request: DirectRequest, usage_source: &str, ) -> Result<DirectCompletion, PluginError>
pub fn cancellation_token(&self) -> Option<&CancellationToken>
pub fn async_task_id(&self) -> Option<&str>
pub fn turn_context(&self) -> &TurnContext
pub fn tool_call_id(&self) -> Option<&str>
pub fn attempt_number(&self) -> u32
pub fn max_attempts(&self) -> u32
pub fn idempotency_key(&self) -> Option<&str>
pub fn put_attachment( &self, data: Vec<u8>, meta: AttachmentCreateMeta, ) -> Result<AttachmentRef, AttachmentStoreError>
Sourcepub fn plugin_input<T: 'static>(&self, plugin_id: &'static str) -> Option<&T>
pub fn plugin_input<T: 'static>(&self, plugin_id: &'static str) -> Option<&T>
Shortcut for TurnContext::plugin_input.
pub fn with_async_task( self, task_id: impl Into<String>, cancellation_token: CancellationToken, ) -> Self
Trait Implementations§
Source§impl Clone for ToolContext
impl Clone for ToolContext
Source§fn clone(&self) -> ToolContext
fn clone(&self) -> ToolContext
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 moreAuto Trait Implementations§
impl Freeze for ToolContext
impl !RefUnwindSafe for ToolContext
impl Send for ToolContext
impl Sync for ToolContext
impl Unpin for ToolContext
impl UnsafeUnpin for ToolContext
impl !UnwindSafe for ToolContext
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