Skip to main content

RegisteredTool

Struct RegisteredTool 

Source
pub struct RegisteredTool { /* private fields */ }
Expand description

Runtime-owned registered tool definition.

A registered tool binds a provider-visible spec to an executor. It does not start or automate a tool loop. crate::Runtime::submit_tool_result is the external/manual result path; crate::Runtime::execute_tool_call is the runtime-registered executor path.

Implementations§

Source§

impl RegisteredTool

Source

pub fn new( spec: ToolSpec, executor: Arc<dyn ToolExecutor>, action_kind: ToolActionKind, ) -> Self

Creates a registered tool with an explicit runtime-owned action category.

The spec is provider-visible after adapter rendering, but the executor remains a runtime-owned boundary. The action category stays inside runtime and is not rendered into the provider-visible tool spec.

Source

pub fn with_external_binding(self, binding: ExternalToolBinding) -> Self

Attaches a stable adapter binding for session catalog persistence.

Binding metadata is never rendered into the model’s tool definition.

Source

pub fn external_binding(&self) -> Option<&ExternalToolBinding>

Returns the adapter identity, if this tool belongs to an external catalog.

Source

pub fn with_action_proposal(self) -> Self

Enables read-only proposal evidence for a mutating tool.

Runtime calls ToolExecutor::propose only for registered tools that explicitly opt in here. The hook is still skipped for read-only tools.

Source

pub fn with_low_risk_workspace_patch_lane(self) -> Self

Opts a ToolActionKind::WorkspaceWrite tool into the low-risk workspace patch lane when the runtime enables crate::RuntimeBuilder::allow_low_risk_apply_patches.

Automatically enables read-only action proposals so callers cannot misconfigure the patch lane without proposal preflight.

Source

pub fn with_parallel_safe_execution(self) -> Self

Opts this tool into bounded concurrent execution within one model batch.

Use this only when concurrent calls cannot race through writes, processes, network access, permissions, or runtime-control state.

Source

pub fn read_only(spec: ToolSpec, executor: Arc<dyn ToolExecutor>) -> Self

Creates a registered read-only tool.

Use this only for tools that do not write workspace state or execute commands. Network access is controlled by runtime profile, not by this constructor.

Source

pub fn bridge(spec: ToolSpec) -> Self

Creates a tool whose execution is delegated to an external SDK bridge.

Source

pub fn spec(&self) -> &ToolSpec

Borrows the provider-visible tool specification.

Source

pub fn action_kind(&self) -> ToolActionKind

Returns the runtime-owned action category for this tool.

Source

pub fn runner(&self) -> ToolRunner

Returns where this tool is executed.

Source

pub fn concurrency(&self) -> ToolConcurrency

Returns the runtime execution policy for batched calls.

Source

pub const fn proposals_enabled(&self) -> bool

Returns whether this tool opted into action proposal evidence.

Source

pub const fn low_risk_workspace_patch_lane(&self) -> bool

Returns whether this tool opted into the low-risk workspace patch lane.

Trait Implementations§

Source§

impl Clone for RegisteredTool

Source§

fn clone(&self) -> Self

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 RegisteredTool

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for RegisteredTool

§

impl !UnwindSafe for RegisteredTool

§

impl Forget for RegisteredTool

§

impl Freeze for RegisteredTool
where *const u8 is !null: Freeze, PhantomData<u8>: Freeze, PhantomData<Value>: Freeze, *const LeafNode<String, Value> is !null: Freeze, PhantomData<(Owned, LeafOrInternal)>: Freeze, PhantomData<Box<(String, Value)>>: Freeze, *const ArcInner<dyn ToolExecutor> is !null: Freeze, PhantomData<ArcInner<dyn ToolExecutor>>: Freeze,

§

impl Move for RegisteredTool

§

impl Send for RegisteredTool
where RawVecInner: Send, NodeRef<Owned, String, Value, LeafOrInternal>: Send, BoxRaw<(String, Value)>: Send, Arc<dyn ToolExecutor>: Send,

§

impl Sync for RegisteredTool
where RawVecInner: Sync, NodeRef<Owned, String, Value, LeafOrInternal>: Sync, BoxRaw<(String, Value)>: Sync, Arc<dyn ToolExecutor>: Sync,

§

impl Unpin for RegisteredTool
where *const u8 is !null: Unpin, *const LeafNode<String, Value> is !null: Unpin, Box<(String, Value)>: Unpin, Arc<dyn ToolExecutor>: Unpin,

§

impl UnsafeUnpin for RegisteredTool

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more