pub struct ToolMetadata {Show 14 fields
pub namespace: String,
pub risk: ToolRisk,
pub is_read_only: bool,
pub is_concurrency_safe: bool,
pub supports_streaming: bool,
pub supports_batch: bool,
pub supports_rollback: bool,
pub max_output_bytes: Option<usize>,
pub exposure: ToolExposure,
pub capabilities: Vec<String>,
pub verifier: Option<String>,
pub examples: Vec<Value>,
pub tags: Vec<String>,
pub extensions: Option<HashMap<String, Value>>,
}Expand description
Rich metadata for a tool definition.
Provides the harness with enough information for routing, policy, UI,
concurrency, traces, verifiers, and search — without relying solely on
ToolKind for security decisions.
Fields§
§namespace: StringSemantic namespace for grouping tools (e.g. “file”, “code”, “process”, “mcp”).
risk: ToolRiskRisk level hint for the harness: how dangerous is this tool by default.
is_read_only: boolWhether this tool only reads state (never mutates repo, memory, or config).
is_concurrency_safe: boolWhether this tool is safe to call concurrently with other tools.
supports_streaming: boolWhether this tool supports streaming output via events.
supports_batch: boolWhether this tool can process multiple items in a single call.
supports_rollback: boolWhether this tool supports rollback (undo of its effects).
max_output_bytes: Option<usize>Maximum output bytes the tool produces before truncation.
exposure: ToolExposureVisibility/exposure mode for tool registry routing.
capabilities: Vec<String>Capabilities required or provided by this tool.
verifier: Option<String>Verifier spec hint: which verifier to run after this tool completes.
examples: Vec<Value>Example invocations for the model (shown in tool.search results).
Tags for search and categorization.
extensions: Option<HashMap<String, Value>>Arbitrary extended metadata (future-proof).
Implementations§
Source§impl ToolMetadata
impl ToolMetadata
Sourcepub fn reader(namespace: &str, tags: &[&str]) -> Self
pub fn reader(namespace: &str, tags: &[&str]) -> Self
Creates a read tool (file reads, searches).
Sourcepub fn writer(namespace: &str, tags: &[&str]) -> Self
pub fn writer(namespace: &str, tags: &[&str]) -> Self
Creates a write tool (file writes, edits, patches).
Sourcepub fn command(namespace: &str, tags: &[&str]) -> Self
pub fn command(namespace: &str, tags: &[&str]) -> Self
Creates a command/execution tool (bash, process).
Source§impl ToolMetadata
impl ToolMetadata
Sourcepub fn is_default(&self) -> bool
pub fn is_default(&self) -> bool
Returns true if this metadata is the default (unset) value. Used by ToolExecutor to detect tools that need builtin metadata injection.
Sourcepub fn with_exposure(self, exposure: ToolExposure) -> Self
pub fn with_exposure(self, exposure: ToolExposure) -> Self
Builder: sets exposure mode.
Sourcepub fn with_capability(self, caps: &[&str]) -> Self
pub fn with_capability(self, caps: &[&str]) -> Self
Builder: sets capabilities.
Sourcepub fn with_max_output(self, bytes: usize) -> Self
pub fn with_max_output(self, bytes: usize) -> Self
Builder: sets max output bytes.
Builder: adds tags.
Trait Implementations§
Source§impl Clone for ToolMetadata
impl Clone for ToolMetadata
Source§impl Debug for ToolMetadata
impl Debug for ToolMetadata
Source§impl Default for ToolMetadata
impl Default for ToolMetadata
Source§impl<'de> Deserialize<'de> for ToolMetadata
impl<'de> Deserialize<'de> for ToolMetadata
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for ToolMetadata
impl RefUnwindSafe for ToolMetadata
impl Send for ToolMetadata
impl Sync for ToolMetadata
impl Unpin for ToolMetadata
impl UnsafeUnpin for ToolMetadata
impl UnwindSafe for ToolMetadata
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§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> ⓘ
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> ⓘ
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