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
impl RegisteredTool
Sourcepub fn new(
spec: ToolSpec,
executor: Arc<dyn ToolExecutor>,
action_kind: ToolActionKind,
) -> Self
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.
Sourcepub fn with_external_binding(self, binding: ExternalToolBinding) -> Self
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.
Sourcepub fn external_binding(&self) -> Option<&ExternalToolBinding>
pub fn external_binding(&self) -> Option<&ExternalToolBinding>
Returns the adapter identity, if this tool belongs to an external catalog.
Sourcepub fn with_action_proposal(self) -> Self
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.
Sourcepub fn with_parallel_safe_execution(self) -> Self
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.
Sourcepub fn read_only(spec: ToolSpec, executor: Arc<dyn ToolExecutor>) -> Self
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.
Sourcepub fn bridge(spec: ToolSpec) -> Self
pub fn bridge(spec: ToolSpec) -> Self
Creates a tool whose execution is delegated to an external SDK bridge.
Sourcepub fn action_kind(&self) -> ToolActionKind
pub fn action_kind(&self) -> ToolActionKind
Returns the runtime-owned action category for this tool.
Sourcepub fn runner(&self) -> ToolRunner
pub fn runner(&self) -> ToolRunner
Returns where this tool is executed.
Sourcepub fn concurrency(&self) -> ToolConcurrency
pub fn concurrency(&self) -> ToolConcurrency
Returns the runtime execution policy for batched calls.
Sourcepub fn proposals_enabled(&self) -> bool
pub fn proposals_enabled(&self) -> bool
Returns whether this tool opted into action proposal evidence.