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§fn clone(&self) -> ToolMetadata
fn clone(&self) -> ToolMetadata
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more