pub struct ScriptProvider { /* private fields */ }Expand description
Global script tool supply: namespace script.{name}, a name → entry table.
Contract invariant: call rejects every foreign key (builtin / mcp. / plugin. all get
AgentError::ToolNotFound).
Implementations§
Source§impl ScriptProvider
impl ScriptProvider
Sourcepub fn new(entries: impl IntoIterator<Item = ScriptToolEntry>) -> Self
pub fn new(entries: impl IntoIterator<Item = ScriptToolEntry>) -> Self
Build the table in bulk; duplicate names keep the first one (design: skip the later one at load time and warn — the warning lives at the product layer).
Sourcepub fn insert(&mut self, entry: ScriptToolEntry) -> Option<ScriptToolEntry>
pub fn insert(&mut self, entry: ScriptToolEntry) -> Option<ScriptToolEntry>
Add/replace one entry.
Sourcepub fn remove(&mut self, name: &str) -> Option<ScriptToolEntry>
pub fn remove(&mut self, name: &str) -> Option<ScriptToolEntry>
Remove one entry (used by /tools remove; ledger cleanup is the product layer’s job, see approval_ledger).
pub fn get(&self, name: &str) -> Option<&ScriptToolEntry>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl Debug for ScriptProvider
impl Debug for ScriptProvider
Source§impl Default for ScriptProvider
impl Default for ScriptProvider
Source§impl ToolProvider for ScriptProvider
impl ToolProvider for ScriptProvider
Source§fn list<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = AgentResult<Vec<ToolDescriptor>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = AgentResult<Vec<ToolDescriptor>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Enumerate the currently exposed tools. Identity keys MUST already be fully qualified (
ToolIdentity). Read moreSource§fn call<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
identity: &'life1 ToolIdentity,
args: &'life2 Value,
ctx: &'life3 ToolContext,
) -> Pin<Box<dyn Future<Output = AgentResult<Vec<Content>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn call<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
identity: &'life1 ToolIdentity,
args: &'life2 Value,
ctx: &'life3 ToolContext,
) -> Pin<Box<dyn Future<Output = AgentResult<Vec<Content>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Execute a tool by identity key. Read more
Source§fn health<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = AgentResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn health<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = AgentResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Cheap liveness probe (MCP reconnection, wasm runtime, whether the script is still
around). On failure, returns an error string explaining what is broken; never panics.
Auto Trait Implementations§
impl Forget for ScriptProvider
impl Freeze for ScriptProvider
impl Move for ScriptProvider
impl RefUnwindSafe for ScriptProvider
impl Send for ScriptProvider
impl Sync for ScriptProvider
impl Unpin for ScriptProvider
impl UnsafeUnpin for ScriptProvider
impl UnwindSafe for ScriptProvider
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