Struct McpToolWrapper
pub struct McpToolWrapper { /* private fields */ }Expand description
A zeroclaw Tool backed by an MCP server tool.
The prefixed_name (e.g. filesystem__read_file) is what the agent loop
sees. The registry knows how to route it to the correct server.
security is the execution-scope SecurityPolicy snapshot (source of truth
for workspace_dir) — an immutable Arc, not a reloadable live handle. The
workspace path is resolved from it at execute time, not cached.
Implementations§
Source§impl McpToolWrapper
impl McpToolWrapper
pub fn new( prefixed_name: String, def: McpToolDef, registry: Arc<McpRegistry>, security: Arc<SecurityPolicy>, ) -> Self
Trait Implementations§
Source§impl Attributable for McpToolWrapper
impl Attributable for McpToolWrapper
fn role(&self) -> Role
fn alias(&self) -> &str
Source§fn tool_provenance(&self) -> ToolProvenance
fn tool_provenance(&self) -> ToolProvenance
Classifies whether a tool implementation is first-party native code or
an extension. The conservative default prevents a new wrapper from
inheriting native presentation privileges accidentally.
Source§impl Tool for McpToolWrapper
impl Tool for McpToolWrapper
Source§fn spec(&self) -> ToolSpec
fn spec(&self) -> ToolSpec
Override the default: hand out the stored schema by Arc::clone
(pointer copy + refcount increment) instead of deep-cloning it.
MCP schemas can be tens of KB and specs are rebuilt every agent-loop
iteration, so this is the hot path of
Source§fn description(&self) -> &str
fn description(&self) -> &str
Human-readable description
Source§fn parameters_schema(&self) -> Value
fn parameters_schema(&self) -> Value
JSON schema for parameters
Source§fn execute<'life0, 'async_trait>(
&'life0 self,
args: Value,
) -> Pin<Box<dyn Future<Output = Result<ToolResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn execute<'life0, 'async_trait>(
&'life0 self,
args: Value,
) -> Pin<Box<dyn Future<Output = Result<ToolResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Execute the tool with given arguments
Source§fn output_schema(&self) -> Option<Value>
fn output_schema(&self) -> Option<Value>
JSON schema describing the structured output this tool attaches to
ToolOutput::data, when it declares one. None means the tool
emits display text only; authoring surfaces fall back to
sample-derived shapes from captured runs.Source§fn param_domains(&self) -> Vec<(&'static str, OptionDomain)>
fn param_domains(&self) -> Vec<(&'static str, OptionDomain)>
Option domains for parameters whose value sets live in runtime
config rather than the static schema (channel refs, peer targets,
…). Surfaces resolve these through the runtime to render real
selectable choices. Default: no domain-typed parameters.
Source§fn invocation_triggers(&self) -> Vec<String>
fn invocation_triggers(&self) -> Vec<String>
Lowercase phrases that suggest an inbound message wants this tool —
e.g. routing wording or configured destination names for a delivery
tool. A pre-turn prefilter may scan the message against these and
nudge the model to consider the tool; the tool itself is never called
by the prefilter. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for McpToolWrapper
impl !UnwindSafe for McpToolWrapper
impl Freeze for McpToolWrapper
impl Send for McpToolWrapper
impl Sync for McpToolWrapper
impl Unpin for McpToolWrapper
impl UnsafeUnpin for McpToolWrapper
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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