pub struct Definition { /* private fields */ }Expand description
A reusable code-defined capability.
A definition is an immutable value: clone it to install the same capability on several agents. The consuming host registers it privately when the agent’s session starts; capability authors never manipulate an engine registry.
Implementations§
Source§impl Definition
impl Definition
Sourcepub fn new(
id: impl Into<String>,
name: impl Into<String>,
description: impl Into<String>,
) -> Self
pub fn new( id: impl Into<String>, name: impl Into<String>, description: impl Into<String>, ) -> Self
Start a capability definition.
id is the stable persisted identifier. name and description are
human-facing catalog text. These values, tool names, and tool input
schemas are validated by the consuming boundary (e.g. the Framework’s
AgentBuilder::build).
Sourcepub fn instructions(self, instructions: impl Into<String>) -> Self
pub fn instructions(self, instructions: impl Into<String>) -> Self
Add capability-level behavioral guidance to the agent’s system prompt.
Do not repeat facts already expressed by tool names, descriptions, or schemas. Use this for cross-tool ordering, constraints, and semantics.
Sourcepub fn metadata(self, metadata: impl Into<Value>) -> Self
pub fn metadata(self, metadata: impl Into<Value>) -> Self
Attach host-owned, JSON metadata for catalogs and embedding hosts.
The engine does not interpret this value. It may be persisted or shown to clients, so it must never contain credentials or sensitive payloads.
Sourcepub fn description(&self) -> &str
pub fn description(&self) -> &str
The capability description.
Sourcepub fn instructions_text(&self) -> Option<&str>
pub fn instructions_text(&self) -> Option<&str>
Capability-level instructions, when configured.
Sourcepub fn metadata_value(&self) -> Option<&Value>
pub fn metadata_value(&self) -> Option<&Value>
Host-owned capability metadata, when configured.
Sourcepub fn validate(&self) -> Result<(), CapabilityError>
pub fn validate(&self) -> Result<(), CapabilityError>
Validate the definition’s identity and structural rules.
Trait Implementations§
Source§impl Clone for Definition
impl Clone for Definition
Source§fn clone(&self) -> Definition
fn clone(&self) -> Definition
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Definition
impl Debug for Definition
Source§impl From<Definition> for CapabilitySpec
Available on crate feature definition only.
impl From<Definition> for CapabilitySpec
definition only.Source§fn from(definition: Definition) -> Self
fn from(definition: Definition) -> Self
Source§impl IntoCapability for Definition
Available on crate feature definition only.
impl IntoCapability for Definition
definition only.