pub struct PluginToolContext {
pub plugin_id: PluginId,
pub workspace_root: PathBuf,
pub kv: ScopedKvStore,
pub config: HashMap<String, Value>,
pub session_id: Option<SessionId>,
pub user_id: Option<Uuid>,
}Expand description
Context provided to a plugin tool during execution.
Combines:
- Plugin identity (
plugin_id) - Workspace root (from
ToolContext) - Scoped KV store (pre-bound to
plugin:{plugin_id}) - Plugin config
- Session/user info (from
HookContext)
Fields§
§plugin_id: PluginIdThe plugin this tool belongs to.
workspace_root: PathBufThe workspace root directory.
kv: ScopedKvStorePre-scoped KV store (plugin:{plugin_id} namespace).
config: HashMap<String, Value>Plugin configuration from the manifest.
session_id: Option<SessionId>Current session ID, if available.
user_id: Option<Uuid>Current user ID, if available.
Implementations§
Source§impl PluginToolContext
impl PluginToolContext
Sourcepub fn new(
plugin_id: PluginId,
workspace_root: PathBuf,
kv: ScopedKvStore,
) -> Self
pub fn new( plugin_id: PluginId, workspace_root: PathBuf, kv: ScopedKvStore, ) -> Self
Create a new plugin tool context.
Sourcepub fn with_config(self, config: HashMap<String, Value>) -> Self
pub fn with_config(self, config: HashMap<String, Value>) -> Self
Set the plugin configuration.
Sourcepub fn with_session(self, session_id: SessionId) -> Self
pub fn with_session(self, session_id: SessionId) -> Self
Set the session ID.
Trait Implementations§
Source§impl Clone for PluginToolContext
impl Clone for PluginToolContext
Source§fn clone(&self) -> PluginToolContext
fn clone(&self) -> PluginToolContext
Returns a duplicate of the value. Read more
1.0.0 · 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 PluginToolContext
impl !RefUnwindSafe for PluginToolContext
impl Send for PluginToolContext
impl Sync for PluginToolContext
impl Unpin for PluginToolContext
impl UnsafeUnpin for PluginToolContext
impl !UnwindSafe for PluginToolContext
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
Source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
Query the “status” flags for the
self file descriptor.Source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
Source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
Set the “status” flags for the
self file descriptor. Read moreSource§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more