pub struct ToolContext {
pub session_id: SessionId,
pub user_event_tx: UnboundedSender<UserEvent>,
pub llm_client: Option<Arc<dyn LlmClient>>,
pub session_store: Option<Arc<dyn SessionStore>>,
pub language: Language,
pub cancel_token: CancellationToken,
}Fields§
§session_id: SessionId§user_event_tx: UnboundedSender<UserEvent>Channel for sending user-space events (progress, sub-agent, structured).
Tools should use emit_user_event() or emit_progress().
llm_client: Option<Arc<dyn LlmClient>>§session_store: Option<Arc<dyn SessionStore>>§language: LanguageLanguage preference for tool output.
Defaults to Language::En if not set.
cancel_token: CancellationTokenCancellation token for checking if the operation should be cancelled.
Implementations§
Source§impl ToolContext
impl ToolContext
Sourcepub fn emit_user_event(&self, event: UserEvent)
pub fn emit_user_event(&self, event: UserEvent)
Send a user-space event (progress, sub-agent forwarding, structured data).
Sourcepub fn emit_progress(&self, text: impl Into<String>)
pub fn emit_progress(&self, text: impl Into<String>)
Convenience: send a progress event with text.
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 !RefUnwindSafe for ToolContext
impl !UnwindSafe for ToolContext
impl Freeze for ToolContext
impl Send for ToolContext
impl Sync for ToolContext
impl Unpin for ToolContext
impl UnsafeUnpin 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