pub enum ToolDefinition {
Builtin(BuiltinTool),
ClientSide(ClientSideTool),
}Expand description
Tool definition in agent configuration
Variants§
Builtin(BuiltinTool)
Built-in tool - executed by the worker via ToolRegistry
ClientSide(ClientSideTool)
Client-side tool - executed by the client, not the server
Implementations§
Source§impl ToolDefinition
impl ToolDefinition
Sourcepub fn display_name(&self) -> Option<&str>
pub fn display_name(&self) -> Option<&str>
Get the tool display name regardless of variant
Sourcepub fn description(&self) -> &str
pub fn description(&self) -> &str
Get the tool description regardless of variant
Sourcepub fn parameters(&self) -> &Value
pub fn parameters(&self) -> &Value
Get the tool parameters schema regardless of variant
Sourcepub fn full_parameters(&self) -> &Value
pub fn full_parameters(&self) -> &Value
Get the full (pre-deferral) parameter schema, falling back to parameters().
When DeferSchemaHook strips a tool’s schema it saves the original in
full_parameters. Callers that need the real schema (e.g. tool_search)
should use this method so deferred tools still return useful results.
Sourcepub fn policy(&self) -> &ToolPolicy
pub fn policy(&self) -> &ToolPolicy
Get the tool policy regardless of variant
Sourcepub fn deferrable(&self) -> &DeferrablePolicy
pub fn deferrable(&self) -> &DeferrablePolicy
Get the deferrable policy for tool_search
Sourcepub fn concurrency_class(&self) -> Option<&str>
pub fn concurrency_class(&self) -> Option<&str>
Scheduling conflict key for this tool, if any (see
ToolHints::concurrency_class). None means the tool has no mutation
conflicts and may always run concurrently with others.
Sourcepub fn is_cpu_bound(&self) -> bool
pub fn is_cpu_bound(&self) -> bool
Whether this tool performs CPU-bound/non-yielding in-process work and should be offloaded to its own task by the act scheduler.
Sourcepub fn side_effect_class(&self) -> SideEffectClass
pub fn side_effect_class(&self) -> SideEffectClass
Effective side-effect class for this tool (defaults to AtMostOnce).
Sourcepub fn capability_attribution(&self) -> Option<(&str, Option<&str>)>
pub fn capability_attribution(&self) -> Option<(&str, Option<&str>)>
Get reporting attribution for the capability that contributed this tool.
Sourcepub fn with_category(self, category: impl Into<String>) -> ToolDefinition
pub fn with_category(self, category: impl Into<String>) -> ToolDefinition
Set the category on this tool definition (builder pattern)
Sourcepub fn with_hints(self, hints: ToolHints) -> ToolDefinition
pub fn with_hints(self, hints: ToolHints) -> ToolDefinition
Set the hints on this tool definition (builder pattern)
Sourcepub fn with_capability_attribution(
self,
capability_id: impl Into<String>,
capability_name: Option<impl Into<String>>,
) -> ToolDefinition
pub fn with_capability_attribution( self, capability_id: impl Into<String>, capability_name: Option<impl Into<String>>, ) -> ToolDefinition
Set reporting attribution on this tool definition (builder pattern).
Sourcepub fn with_human_intent_argument(self) -> ToolDefinition
pub fn with_human_intent_argument(self) -> ToolDefinition
Add the cross-cutting human_intent argument to the tool’s JSON schema.
This field is model-authored narration for UI rendering. Tool execution strips it before invoking the underlying tool implementation.
Trait Implementations§
Source§impl Clone for ToolDefinition
impl Clone for ToolDefinition
Source§fn clone(&self) -> ToolDefinition
fn clone(&self) -> ToolDefinition
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 ToolDefinition
impl Debug for ToolDefinition
Source§impl<'de> Deserialize<'de> for ToolDefinition
impl<'de> Deserialize<'de> for ToolDefinition
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ToolDefinition, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ToolDefinition, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl From<&ToolDefinition> for ToolDefinitionSummary
impl From<&ToolDefinition> for ToolDefinitionSummary
Source§fn from(tool: &ToolDefinition) -> Self
fn from(tool: &ToolDefinition) -> Self
Source§impl Serialize for ToolDefinition
impl Serialize for ToolDefinition
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for ToolDefinition
impl RefUnwindSafe for ToolDefinition
impl Send for ToolDefinition
impl Sync for ToolDefinition
impl Unpin for ToolDefinition
impl UnsafeUnpin for ToolDefinition
impl UnwindSafe for ToolDefinition
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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request