pub struct ToolCtx {
pub messages: MessageChannel,
pub session_id: String,
pub tasks: TaskManager,
}Expand description
调用工具时注入的运行时上下文。
大多数工具用不到它(用 ToolRegistry::register 注册的 handler 拿不到);
需要往前端推实时消息、或管理后台任务的工具(如 bash/check/kill)用
ToolRegistry::register_with_ctx 注册,才会收到这个上下文。
Fields§
§messages: MessageChannel对前端的实时消息通道。
session_id: String当前会话 id。
tasks: TaskManager后台任务登记表(跨工具调用共享)。
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ToolCtx
impl RefUnwindSafe for ToolCtx
impl Send for ToolCtx
impl Sync for ToolCtx
impl Unpin for ToolCtx
impl UnsafeUnpin for ToolCtx
impl UnwindSafe for ToolCtx
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