Skip to main content

Definition

Struct Definition 

Source
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

Source

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).

Source

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.

Source

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.

Source

pub fn tool<H>(self, handler: H) -> Self
where H: Handler,

Add one typed tool handler.

Source

pub fn id(&self) -> &str

The stable capability identifier.

Source

pub fn name(&self) -> &str

The human-readable capability name.

Source

pub fn description(&self) -> &str

The capability description.

Source

pub fn instructions_text(&self) -> Option<&str>

Capability-level instructions, when configured.

Source

pub fn metadata_value(&self) -> Option<&Value>

Host-owned capability metadata, when configured.

Source

pub fn tools(&self) -> &[Tool]

Typed tool descriptors in registration order.

Source

pub fn validate(&self) -> Result<(), CapabilityError>

Validate the definition’s identity and structural rules.

Trait Implementations§

Source§

impl Clone for Definition

Source§

fn clone(&self) -> Definition

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Definition

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<Definition> for CapabilitySpec

Available on crate feature definition only.
Source§

fn from(definition: Definition) -> Self

Converts to this type from the input type.
Source§

impl IntoCapability for Definition

Available on crate feature definition only.
Source§

fn into_capability(self) -> CapabilitySpec

Consume the value and return its normalized specification.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.